cavendano Posted December 2, 2008 Share Posted December 2, 2008 cant figure out why this is not looping!! any help would be appreciated! edit: right now im getting one result but thats it... <?php include 'function.php'; $page = (isset($_GET['page'])) ? $_GET['page'] : 0; $page = ($page < 1) ? 0 : $page; $srch = preg_replace( "/ /", "+", $_GET[search] ); $url1 = "http://websitename.net/search/en.html?q=".$srch."&page=".$page; $res = file_get_contents($url1); $i = 1; $hitung = 0; $res = strstr($res,'<tr class="top">'); if($res) { while($i <= 12) { $res = strstr($res, '<td><h2>'); $dodol = extstr3($res,'<a href="/file/','</span>'); $theId = preg_match('/(.*)\/(.*)\//', $dodol, $results); $theId = preg_match('/(.*)\//', $results[1], $results); $theId = preg_match('/\/(.*)/', $results[1], $results); //$dodol = strstr($dodol,$theId); $theId = $results[1]; $name = extstr3($dodol,'">','</a> <span>'); $res = strstr($res, '</table>'); $name = trim($name); $name = str_replace('(','',$name); $name = str_replace(')','',$name); $name = str_replace(''','',$name); $name = str_replace('&','and',$name); $name = str_replace("'",'',$name); // Download URL $download = "http://www.websitename.net/{$theId}/download.jpg"; // Play URL $purl = $download; $link = "src=websitename&id=".$theId."&name=".$name."&url=".$purl; if ( $name && $link) { include( "the-template/list.inc.php" ); $hitung++; } ++$i; } $nextpage = $p + 1; $prevpage = $p - 1; $nextpage = "?source=".$source."&search={$srch}&page={$nextpage}"; $prevpage = "?source=".$source."&search={$srch}&page={$prevpage}"; echo "<table width=\"100%\" align=\"center\"><tr>"; if ( 1 < $p ) { echo "<td align=\"left\"><a href=\""; echo $prevpage; echo "\">"; echo $lang[Prev]; echo "</a></td>"; } if ( $hitung == 0 ) { echo "<center>".$lang['NoResultsMSG']."</center>"; } if ( $hitung != 12 ) { echo ""; } else { echo "<td align=\"right\"><a href=\""; echo $nextpage; echo "\">"; echo $lang[Next]; echo "</a></td>"; } echo "</tr></table>"; } //end if($res) else { echo "<center>".$lang['NoResultsMSG']."</center>"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/135082-scraper-not-looping/ Share on other sites More sharing options...
DeanWhitehouse Posted December 2, 2008 Share Posted December 2, 2008 Try adding error_reporting(E_ALL); to the top of the code. Quote Link to comment https://forums.phpfreaks.com/topic/135082-scraper-not-looping/#findComment-703620 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.