Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $html = file_get_contents('http://www.movie2k.tv/Drinking-Buddies-watch-movie-16747914.html'); //There are 13 links on this page
- $scrapedmovie = new DOMDocument();
- $previous_value = libxml_use_internal_errors(true);
- $scrapedmovie->loadHTML($html);
- libxml_clear_errors();
- libxml_use_internal_errors($previous_value);
- /******************
- start: filenuke's code
- *******************
- // $movieslinks = $scrapedmovie->getElementById('menu')->getElementsByTagName('tr');//get all rows in table with links
- // $totalLinks = $movieslinks->length - 1;//how many links we found. we minus 1 because first row is useless
- // //loop and put the quality of movie and link in arrays
- // //we skip the 1st row coz its not having anything useful in it (i=1 instead of 0)
- // for ($i = 1; $i<$totalLinks + 1; $i++)
- // {
- // $movielink[$i - 1] = $movieslinks->item($i)->getElementsbyTagName('a')->item(0)->getAttribute('href');
- // $moviequality[$i - 1] = $movieslinks->item($i)->getElementsbyTagName('td')->item(1)->getElementsByTagName('img')->item(0)->getAttribute('title');
- // $moviequality[$i - 1] = substr($moviequality[$i - 1], 14, strlen($moviequality[$i - 1]) - 14);//get rid of useless part of moviequality string
- // }
- // echo "<b>Total " . $totalLinks . ' hoster links found.</b><br>';
- // print_r($movielink);
- // echo "<br>";
- // print_r($moviequality);
- *******************
- end: filenuke's code
- ******************/
- $count = 0;
- $trs = $scrapedmovie->getElementsByTagName('tr');
- foreach ($trs as $tr){
- if ($tr->getAttribute('id')=="tablemoviesindex2"){
- echo $tr->getElementsByTagName('a')->item(0)->getAttribute('href') . PHP_EOL;
- $count++;
- }
- }
- echo 'There are ' . $count . ' matching links.'; //only returns 9
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement