Re: saving a jpeg via HTTP

From: Date: Sat, 15 Jun 2002 16:07:36 +0000
Subject: Re: saving a jpeg via HTTP
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-102350@lists.php.net to get a copy of this message
On Sat, Jun 15, 2002 at 06:02:58PM +0200, Daniel Tryba wrote: > This works for me: Hmmm, one while(!feof()) to many.... not that it really matters :) <?php if($fi=fsockopen("host",80)) { fputs($fi,"GET /image.gif HTTP/1.0\r\n\r\n"); while(!preg_match("/^\r?\n$/",fgets($fi,1024))); //skip headers if($fo=fopen("/tmp/tmp.gif","w")) { while(!feof($fi)) { fwrite($fo,fread($fi,65535)); } fclose($fo); } fclose($fi); } ?> -- Daniel Tryba

« previous php.general (#102350) next »