Re: Fw: PHP script needs to timeout upon FOPEN to URL

From: Date: Sat, 14 Dec 2002 02:16:22 +0000
Subject: Re: Fw: PHP script needs to timeout upon FOPEN to URL
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-128238@lists.php.net to get a copy of this message
Try this: while ((!($file = @fopen("http://www.myurl.com", "r"))) && (time() < $startTime + $time)); Here's why: http://www.php.net/manual/sk/language.operators.php Regards, Bogdan Phil Powell wrote:
----- Original Message ----- From: "soazine@pop.erols.com" <soazine@pop.mail.rcn.net> To: <soazine@erols.com> Sent: Friday, December 13, 2002 5:13 PM Subject: PHP script needs to timeout upon FOPEN to URL I have the following line: while (!($file = @fopen("http://www.myurl.com", "r")) && time() < $startTime + $time); if (!$file){ echo "Timed out, try again later"; } else { // do stuff } Problem is, when it attempts to connect to the remote server, it's supposed to time out after 2-5 seconds, but it doesn't, it just locks up :( Any suggestions? Phil -------------------------------------------------------------------- mail2web - Check your email from the web at http://mail2web.com/ .


« previous php.general (#128238) next »