Jump to content


Photo

Internal Server Error / Script Timeout


  • Please log in to reply
No replies to this topic

#1 SupaMonkey

SupaMonkey
  • Members
  • PipPip
  • Member
  • 17 posts
  • LocationSouth Africa

Posted 01 March 2006 - 07:29 AM

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:
$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;

Website design, development & web hosting | 4x4 Electrical & Hydraulic Winches | Car Parts, Accessories, Styling, Lambo/Body/HID/Xenon Kits | Escorts, strippers & adult clubs directory | Adult Website design, development & web hosting




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users