NYCPHP Meetup

NYPHP.org

[nycphp-talk] Fw: PHP script needs to timeout upon FOPEN to URL

CHUN-YIU LAM chun_lam at hotmail.com
Fri Dec 13 21:52:20 EST 2002


1. I don't see that you assign anything to $time and also you are not 
incrementing it.
2. To do while loop like this is very dangerous. (Might cause you to open a 
lot of file pointer to the same file)
3. Maybe you can use a socket instead.

----Original Message Follows----
From: "Phil Powell" <soazine at erols.com>
Reply-To: talk at nyphp.org
To: NYPHP Talk <talk at nyphp.org>
Subject: [nycphp-talk] Fw: PHP script needs to timeout upon FOPEN to URL
Date: Fri, 13 Dec 2002 18:16:07 -0500
Received: from mc2-f20.law16.hotmail.com ([65.54.237.27]) by 
mc2-s1.law16.hotmail.com with Microsoft SMTPSVC(5.0.2195.5600); Fri, 13 Dec 
2002 15:23:33 -0800
Received: from parsec.nyphp.org ([66.250.131.26]) by 
mc2-f20.law16.hotmail.com with Microsoft SMTPSVC(5.0.2195.5600); Fri, 13 Dec 
2002 15:22:37 -0800
Received: from nyphp.org (parsec.nyphp.org [66.250.131.26])by 
parsec.nyphp.org (8.12.6/8.12.6) with ESMTP id gBDNG7St029580;Fri, 13 Dec 
2002 18:16:07 -0500 (EST)(envelope-from listmaster at nyphp.org)
Message-Id: <200212132316.gBDNG7St029580 at parsec.nyphp.org>
X-Paralist-Archived: <http://nyphp.org/list/paralist_archive.php?L_mid=1903>
X-List-Software: Paralist 0.6
List-ID: <nyphptalk.nyphp.org>
List-Owner: <mailto:listmaster at nyphp.org>
List-Archive: <http://nyphp.org/list/paralist_archive.php?L_lid=1>
List-Subscribe: <http://nyphp.org/list/>
List-Unsubscribe: <http://nyphp.org/list/>
Organization: New York PHP
X-Mailer: Paramail 0.5
Return-Path: listmaster at nyphp.org
X-OriginalArrivalTime: 13 Dec 2002 23:22:37.0924 (UTC) 
FILETIME=[865A1A40:01C2A2FE]

----- Original Message -----
From: "soazine at pop.erols.com" <soazine at pop.mail.rcn.net>
To: <soazine at 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/ .





--- Unsubscribe at http://nyphp.org/list/ ---


_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN 8. 
http://join.msn.com/?page=features/junkmail




More information about the talk mailing list