Advertisement
austinh115

[PHP] xat vol scraper

Jun 8th, 2016
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.74 KB | None | 0 0
  1. <?php
  2. $json = json_decode(file_get_contents("http://util.xat.com/wiki/api.php?action=query&titles=Template:List_of_ticket_volunteers&prop=revisions&rvprop=content&format=json"), true);
  3. $wiki = $json['query']['pages'][18011]['revisions'][0]['*'];
  4. $wiki = array_filter(explode("\n", explode("|}", explode("</noinclude>", str_replace("", "", preg_replace("/<!--(.*?)-->/", "", $wiki)))[1])[0]));
  5. $vols = array();
  6. foreach($wiki as $vol) {
  7.     $vol = explode(" | ", explode("}}", explode("{{", $vol)[1])[0]);
  8.     unset($vol[0]);
  9.     $vol2 = array();
  10.     foreach($vol as $v) {
  11.         $v = explode("=", $v);
  12.         $vol2[$v[0]] = $v[1];
  13.     }
  14.     /*$name = $vol2['name'];
  15.     unset($vol2['name']);
  16.     $vols[$name] = $vol2;*/
  17.     $vols[$vol2['xat']] = $vol2['id'];
  18. }
  19. print_r($vols);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement