Re: using fopen() to download remote files

From: Date: Thu, 03 Oct 2002 20:44:08 +0000
Subject: Re: using fopen() to download remote files
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-118782@lists.php.net to get a copy of this message
"Rusty Small" <rusm71@bellsouth.net> wrote in message news:20021003202629.86249.qmail@pb1.pair.com... > Thanks for the help. I made the assumption that all data from each page was > being downloaded but it is not. > > I do have one other question. I've used microtime() to test how long it > takes to download each page and have noticed that some pages may take as > long as 45 seconds to download!!! I know that this lag is out of my control > as it is depends upon the status of the remote server. However, I would > like to tell the script that if "x" amount of time has passed and the > fopen() function is not complete then stop and move on. I've tried using > while and if...else statements using microtime() as the timeout limit but I > didn't have any success. What kind of flow control mechanism should I use > for this?? > Hi, I have never done this give this is shot, try it it should work. you can use passthru()/system() to call wget (you can specify the timeout in wget) (wget will let u know the success or failure) and donwload the file in a temporary folder. then you can use fopen to open the file. HTH gamin.

« previous php.general (#118782) next »