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 22:29:50 EST 2002


I don't think this will work at all.  PHP is a server side include scripting 
language.  This means that the everything is eventually parse into text and 
send to the browser.

You are trying to keep track of time, but when you send to the broswer it 
became static.

I think you should try to get the socket working.



----Original Message Follows----
From: "Phil Powell" <soazine at erols.com>
Reply-To: talk at nyphp.org
To: NYPHP Talk <talk at nyphp.org>
Subject: Re: [nycphp-talk] Fw: PHP script needs to timeout upon FOPEN to URL
Date: Fri, 13 Dec 2002 22:03:41 -0500
Received: from mc7-f14.law1.hotmail.com ([65.54.253.21]) by 
mc7-s16.law1.hotmail.com with Microsoft SMTPSVC(5.0.2195.5600); Fri, 13 Dec 
2002 19:17:42 -0800
Received: from parsec.nyphp.org ([66.250.131.26]) by 
mc7-f14.law1.hotmail.com with Microsoft SMTPSVC(5.0.2195.5600); Fri, 13 Dec 
2002 19:17:42 -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 gBE33fSt030745;Fri, 13 Dec 
2002 22:03:41 -0500 (EST)(envelope-from listmaster at nyphp.org)
Message-Id: <200212140303.gBE33fSt030745 at parsec.nyphp.org>
X-Paralist-Archived: <http://nyphp.org/list/paralist_archive.php?L_mid=1905>
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: 14 Dec 2002 03:17:42.0232 (UTC) 
FILETIME=[5D2CB580:01C2A31F]

Oh sorry..

$time = time();

And I can't use sockets, I tried and it produced nasty errors.. I can only
do it this way, but I might change the while to an if

Phil
----- Original Message -----
From: "CHUN-YIU LAM" <chun_lam at hotmail.com>
To: "NYPHP Talk" <talk at nyphp.org>
Sent: Friday, December 13, 2002 9:52 PM
Subject: Re: [nycphp-talk] Fw: PHP script needs to timeout upon FOPEN to URL


 > 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/ .
 >
 >
 >
 >
 >
 >
 >
 >
 > _________________________________________________________________
 > Tired of spam? Get advanced junk mail protection with MSN 8.
 > http://join.msn.com/?page=features/junkmail
 >
 >
 >
 >
 >
 >



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


_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE* 
http://join.msn.com/?page=features/virus




More information about the talk mailing list