Jump to content

Internal Server Error / Script Timeout


SupaMonkey

Recommended Posts

So I have a script that goes to a page and rips it of all the numbers and then goes onto the next page, etc etc. Basically the script works 100% and I can do up to about 90 pages at a time; as soon as I try and do any more than that - I get an "Internal Server Error" after a while. I tried the whole ob_start / flush theory which is supposedly supposed to work and it hasnt. Any idea's?
- PHP is installed as CGI
- Running Apache
- Script is run off a local webserver and connects to remote page

Here is my script:
[code]$none_found = '';
$found_num = '';
$found_at = '';

set_time_limit(9000);
ob_start();

for ($i = 1; $i <= 90; $i++)
{
    $fh         = fopen("http://www.someplace.com/index.php?id=". $i,'r');
    $result = '';

    while(!feof($fh))
     $result .= fgets($fh);

    fclose($fh);

    $message = strip_tags($result);

    if (preg_match("|\d{3} \d{3} \d{4}|", $message, $numbers_found))
    {
        $found_at  .= $i .",";
        $found_num .= $numbers_found[0] .'<br>';
        mysql_query('insert into zzz_numbers (cellphone) values (\''. $numbers_found[0] .'\')');
    }
    else
        $none_found .= $i .',';
    
    if (substr($i,strlen($i)-1) == '0')
    {
      echo ".";
        
    flush();
    ob_flush();
    }
    sleep(1);
}
echo "<br><br>None found at:<br>". $none_found;
echo "<br><br>Found at:<br>". $found_at;
echo "<br><br>Numbers found :<br>". $found_num;
[/code]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.