NYCPHP Meetup

NYPHP.org

[PHP] fopen have a "setTimeout" feature?

Tim Ward timward at chessish.com
Sun Dec 8 15:10:23 EST 2002


how about something like...

$start = time();
$timeout = 60; // number of seconds to try
while (!$file = fopen("...") && time() < $start + $timeout);
if ($file)
{   // do stuff with file
}

Tim Ward
http://www.chessish.com
mailto:timward at chessish.com
----- Original Message -----
From: Phil Powell <soazine at erols.com>
To: <talk at nyphp.org>; <php-general at lists.php.net>
Sent: Sunday, December 08, 2002 7:32 PM
Subject: [PHP] fopen have a "setTimeout" feature?


Can you set something like a "setTimeout" feature in fopen? That is, if you
use fopen to open a URL for "scraping", if that URL's server is down or
doesn't respond in x seconds, can you set a feature to show an error message
or a "friendly" error message indicating such?

Thanx
Phil





More information about the talk mailing list