Advertisement
Mylolmania

Untitled

Jun 5th, 2016
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. <?php
  2. header("Content-type: text/plain");
  3. header("Content-Disposition: attachment; filename=blizz.txt");
  4. $array = array();
  5. $html1 = file_get_contents('http://us.battle.net/d3/en/forum/3354739/');
  6. $doc1 = new DOMDocument();
  7. libxml_use_internal_errors(TRUE);
  8. if(!empty($html1))
  9. {
  10. $doc1->loadHTML($html1);
  11. libxml_clear_errors();
  12. $xpath1 = new DOMXPath($doc1);
  13. $row1 = $xpath1->query('//a[@class="topic-title"]/@href');
  14. if($row1->length > 0)
  15. {
  16. foreach($row1 as $row)
  17. {
  18. $thread = $row->nodeValue;
  19. $thread = 'http://us.battle.net'.$thread;
  20. $html2 = file_get_contents($thread);
  21. $doc2 = new DOMDocument();
  22. if(!empty($html2))
  23. {
  24. $doc2->loadHTML($html2);
  25. libxml_clear_errors();
  26. $xpath2 = new DOMXPath($doc2);
  27. $row2 = $xpath2->query('//a[@class="context-link d3-class-1"]/@href');
  28. if($row2->length > 0)
  29. {
  30. foreach($row2 as $row)
  31. {
  32. $whole_string = $row->nodeValue;
  33. $cut_string = explode('/', $whole_string);
  34. $main_info = $cut_string[4];
  35. $main_infos = explode('-', $main_info);
  36. $pusharray = array($main_infos[0], $main_infos[1]);
  37. $array[] = $pusharray;
  38. }
  39. }
  40. }
  41. }
  42. }
  43. }
  44. $content = "";
  45. foreach($array as $line)
  46. {
  47.  
  48. echo $line[0].':'.$line[1]."\r\n";
  49. }
  50. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement