Quantcast WoWInterface: SVN - UrbanAchiever - Rev 162 - /trunk/script-import.php

WoWInterface SVN UrbanAchiever

[/] [trunk/] [script-import.php] - Rev 162

Compare with Previous | Blame | View Log

<?php
ini_set
('allow_url_fopen'1);
$URLs = array(
    
"https://www.wowhead.com/achievements/side:-1"=> 1,
    
"https://www.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);

    
$startString '<div id="lv-achievements" class="listview"></div><script type="text/javascript">WH.Gatherer.addData(10, 1, ';
    
$endString ');WH.Gatherer.addData';
        
    
$pos strpos($page$startString);
    
$wokingstring substr($page$pos);
    
$wokingstring str_replace($startString''$wokingstring);

    
$pos strpos($wokingstring$endString);
    
$wokingstring substr($wokingstring0$pos);

    
$wokingstring str_replace($endString""$wokingstring);

    
$json json_decode($wokingstringtrue);

    foreach(
$json as $id => $achievement){
        
$completearray[$id] = $side ',&nbsp;&nbsp;&nbsp;--' str_replace('\\','',$achievement['name_enus']);
    }

}

foreach(
$completearray as $k => $v){
    
$double '';
    if(
$k 1000){
        
$double "&nbsp;&nbsp;&nbsp;";
    }
    echo 
'["' $k '"]'.$double.'&nbsp;&nbsp;&nbsp;= ' $v '<br />';
}

?>

Compare with Previous | Blame