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

WoWInterface SVN UrbanAchiever

[/] [trunk/] [script-import.php] - Blame information for rev 162

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 140 Tomate-202285
<?php
2 148 Tomate-202285
ini_set('allow_url_fopen'1);
3 140 Tomate-202285
$URLs = array(
4 162 Tomate-202285
    "https://www.wowhead.com/achievements/side:-1"=> 1,
5 Tomate-202285
    "https://www.wowhead.com/achievements/side:-2"=> 2
6 154 Tomate-202285
    /*"http://www.wowhead.com/achievements?filter=si=-1;cr=9;crs=2;crv=4000" => 1,
7 140 Tomate-202285
    "http://www.wowhead.com/achievements?filter=si=-1;cr=9;crs=5;crv=4000" => 1,
8 Tomate-202285
    "http://www.wowhead.com/achievements?filter=si=-2;cr=9;crs=2;crv=4000" => 2,
9 154 Tomate-202285
    "http://www.wowhead.com/achievements?filter=si=-2;cr=9;crs=5;crv=4000" => 2*/
10 148 Tomate-202285
);
11 140 Tomate-202285
$completearray = array();
12 Tomate-202285
foreach($URLs as $URL => $side){
13 153 Tomate-202285
    $outputfile "dl.html";
14 Tomate-202285
    $cmd "wget.exe -q \"$URL\" -O $outputfile";
15 Tomate-202285
    exec($cmd);
16 140 Tomate-202285
17 153 Tomate-202285
    $page file_get_contents($outputfile);
18 140 Tomate-202285
    $page str_replace(array("\r\n""\n""\r"), ''$page);
19 Tomate-202285
20 162 Tomate-202285
    $startString '<div id="lv-achievements" class="listview"></div><script type="text/javascript">WH.Gatherer.addData(10, 1, ';
21 Tomate-202285
    $endString ');WH.Gatherer.addData';
22 Tomate-202285
        
23 Tomate-202285
    $pos strpos($page$startString);
24 140 Tomate-202285
    $wokingstring substr($page$pos);
25 162 Tomate-202285
    $wokingstring str_replace($startString''$wokingstring);
26 140 Tomate-202285
27 162 Tomate-202285
    $pos strpos($wokingstring$endString);
28 140 Tomate-202285
    $wokingstring substr($wokingstring0$pos);
29 Tomate-202285
30 162 Tomate-202285
    $wokingstring str_replace($endString""$wokingstring);
31 140 Tomate-202285
32 162 Tomate-202285
    $json json_decode($wokingstringtrue);
33 140 Tomate-202285
34 162 Tomate-202285
    foreach($json as $id => $achievement){
35 Tomate-202285
        $completearray[$id] = $side ',&nbsp;&nbsp;&nbsp;--' str_replace('\\','',$achievement['name_enus']);
36 148 Tomate-202285
    }
37 140 Tomate-202285
38 Tomate-202285
}
39 Tomate-202285
40 Tomate-202285
foreach($completearray as $k => $v){
41 143 Tomate-202285
    $double '';
42 Tomate-202285
    if($k 1000){
43 Tomate-202285
        $double "&nbsp;&nbsp;&nbsp;";
44 Tomate-202285
    }
45 Tomate-202285
    echo '["' $k '"]'.$double.'&nbsp;&nbsp;&nbsp;= ' $v '<br />';
46 140 Tomate-202285
}
47 Tomate-202285
48 Tomate-202285
?>