Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- header("Content-type: text/plain");
- header("Content-Disposition: attachment; filename=blizz.txt");
- $array = array();
- $html1 = file_get_contents('http://us.battle.net/d3/en/forum/3354739/');
- $doc1 = new DOMDocument();
- libxml_use_internal_errors(TRUE);
- if(!empty($html1))
- {
- $doc1->loadHTML($html1);
- libxml_clear_errors();
- $xpath1 = new DOMXPath($doc1);
- $row1 = $xpath1->query('//a[@class="topic-title"]/@href');
- if($row1->length > 0)
- {
- foreach($row1 as $row)
- {
- $thread = $row->nodeValue;
- $thread = 'http://us.battle.net'.$thread;
- $html2 = file_get_contents($thread);
- $doc2 = new DOMDocument();
- if(!empty($html2))
- {
- $doc2->loadHTML($html2);
- libxml_clear_errors();
- $xpath2 = new DOMXPath($doc2);
- $row2 = $xpath2->query('//a[@class="context-link d3-class-1"]/@href');
- if($row2->length > 0)
- {
- foreach($row2 as $row)
- {
- $whole_string = $row->nodeValue;
- $cut_string = explode('/', $whole_string);
- $main_info = $cut_string[4];
- $main_infos = explode('-', $main_info);
- $pusharray = array($main_infos[0], $main_infos[1]);
- $array[] = $pusharray;
- }
- }
- }
- }
- }
- }
- $content = "";
- foreach($array as $line)
- {
- echo $line[0].':'.$line[1]."\r\n";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement