Re: fopen have a "setTimeout" feature?

From: Date: Mon, 09 Dec 2002 06:46:03 +0000
Subject: Re: fopen have a "setTimeout" feature?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-127469@lists.php.net to get a copy of this message
Sorry, your code produced this error and I can't figure out how to debug it :( Warning: fopen("http://www3.brinkster.com/soa/val/profile/display.asp?showLeftNavBann er=1","r") - Error 0 in /users/ppowell/web/profiledisplay.php on line 4 Phil ----- Original Message ----- From: "Tim Ward" <timward@chessish.com> To: "Phil Powell" <soazine@erols.com>; <talk@nyphp.org>; <php-general@lists.php.net> Sent: Sunday, December 08, 2002 3:10 PM Subject: Re: [PHP] fopen have a "setTimeout" feature? > 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@chessish.com > ----- Original Message ----- > From: Phil Powell <soazine@erols.com> > To: <talk@nyphp.org>; <php-general@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 > >

« previous php.general (#127469) next »