Script not returning

megatr0n

Newbie
Joined
Nov 10, 2011
Messages
17
Reaction score
6
I have a script that no longer returns. It times out and does not show anything:


<?php
FOR ($i = 1; $i <= 55; $i++)
{
$html = file_get_contents("httpcolon//wwwdotcool-proxydotnet/index.php?action=proxy-list&page=$i");

preg_match_all('/<div align="left"><a href="(.*?)">(.*?)<\/a><\/div>/s',
$html,
$posts, // will contain the proxies
PREG_SET_ORDER // formats data into an array of proxies
);

foreach ($posts as $post) {
$link = $post[1];
$title = $post[2];


echo ("$title");
echo "<br>";
}
}
?>
Please help.
 
Maybe they blocked your script, because they found out you were ripping their info? Did you use the script in a cron-job?

What happens when you try only one request? What happens if you do an echo for the file_get_contents? Do you get any info? Check your script step-by-step and see what happens.
 
No I haven't used it in a cron but I may do so if I can get it to work. I can browse to the site. The only info I get is timeout from my webhost.
 
As far as I can see you're ripping 55 pages in one run. Start with 1 page and see what comes out. If your host has set the PHP timeout lower than the script does a complete execute, then you get a timeout error. Maybe this is an option to put in your script:
PHP:
set_time_limit(0);
, means that the script shouldn't timeout, but again, if you host (and he does) has set a time limit then you have to make another approach. For eample: let the script execute two times, first run pages 1 to 27, second run do the rest. If this also times out, split it into smaller pieces.
 
Instead of 55, I put 10. I now get a blank page.
 
Try to wget to see if you can establish a connection at all. Secondly I would also recommend to use CURL.
 
1. use curl instend file_get_contents
2. check in your machine if you got ssh access:
curl http://wwwdotcool-proxydotnet/index.php?action=proxy-list&page=0
 
Back
Top