Time out error
Posted: Sun Oct 25, 2009 8:38 am
Can anyone tell me a good way to avoid the issue im having. I need to change the timeout to be around like 5 seconds or so. I get a timeout on one of the websites, it is the same one all the time and does not take long to load in my browser. The return code is always 408 and i think I just need to add code for it to take just a few seconds longer. Does anyone have any ideas. I tried to use a few things but nothing seems to work. Thanks in advance.
-charles
-charles
Code: Select all
<?php
$arr = array("websitearray" =>
array( 1 => "http://www.google.com",
2 => "http://www.msn.com",
3 => "http://www.yahoo.com"
)
);
$site_count = 3;
$loop_count = 1;
while ($loop_count <= $site_count)
{
$current_site = $arr["websitearray"][$loop_count];
$get = file_get_contents($current_site);
// 404: Not Found
// 409: Conflict
// 408: Request Timeout
// 500: Internal Server Error
// 503: Service Unavailable
if ( (preg_match('#404#', $get)) || (preg_match('#409#', $get)) || (preg_match('#408#', $get))
|| (preg_match('#500#', $get))|| (preg_match('#503#', $get)) )
{
echo "$current_site has errors and has failed to load <img src='images/CheckMarkX.jpg'> ";
if (preg_match('#404#', $get)) { echo "Return Code is: 404 <br><br>"; }
if (preg_match('#409#', $get)) { echo "Return Code is: 409 <br><br>"; }
if (preg_match('#408#', $get)) { echo "Return Code is: 408 <br><br>"; }
if (preg_match('#500#', $get)) { echo "Return Code is: 500 <br><br>"; }
if (preg_match('#503#', $get)) { echo "Return Code is: 503 <br><br>"; }
}
else
{
echo "$current_site has passed successfully: <img src='images/green_check.jpg'> <br><br>";
}
$loop_count = $loop_count + 1;
}
?>