Go to most recent revision | Compare with Previous | Blame | View Log
<?php
ini_set('allow_url_fopen', 1);
$URLs = array(
"http://legion.wowhead.com/achievements/side:-1"=> 1
"http://legion.wowhead.com/achievements/side:-2"=> 2
/*"http://www.wowhead.com/achievements?filter=si=-1;cr=9;crs=2;crv=4000" => 1,
"http://www.wowhead.com/achievements?filter=si=-1;cr=9;crs=5;crv=4000" => 1,
"http://www.wowhead.com/achievements?filter=si=-2;cr=9;crs=2;crv=4000" => 2,
"http://www.wowhead.com/achievements?filter=si=-2;cr=9;crs=5;crv=4000" => 2*/
);
$completearray = array();
foreach($URLs as $URL => $side){
$outputfile = "dl.html";
$cmd = "wget.exe -q \"$URL\" -O $outputfile";
exec($cmd);
$page = file_get_contents($outputfile);
$page = str_replace(array("\r\n", "\n", "\r"), '', $page);
$pos = strpos($page, '<div id="lv-achievements" class="listview">');
$wokingstring = substr($page, $pos);
$wokingstring = str_replace('<div id="lv-achievements" class="listview"></div><script type="text/javascript">//<![CDATA[var _ = {};', '', $wokingstring);
$pos = strpos($wokingstring, '_ = g_achievements;');
$wokingstring = substr($wokingstring, 0, $pos);
$wokingstring = str_replace(';$.extend(true, g_achievements, _);', "", $wokingstring);
$workingarray = explode(';', $wokingstring);
foreach($workingarray as $achievement){
$pos = strpos($achievement, '","icon":"');
$achievement = substr($achievement, 0, $pos);
$achievement = str_replace(array('_[', ']={"name_enus":"'), array('', '*-*'), $achievement);
$achievement = explode('*-*', $achievement);
$completearray[$achievement[0]] = $side . ', --' . str_replace('\\','',$achievement[1]);
}
}
foreach($completearray as $k => $v){
$double = '';
if($k < 1000){
$double = " ";
}
echo '["' . $k . '"]'.$double.' = ' . $v . '<br />';
}
?>