On Sat, Jun 15, 2002 at 11:15:42AM -0400, Jeff Bearer wrote: > I'm trying to read it with fsockopen and writing it with fopen to the > file but the file is no good when it's saved, I saw that it saved the > http headers in there so I cut those out but still, the image wan't > viewable.
Are you using the binary safe fread/fwrite()? Didn't forget to fclose() the output file? This works for me: <?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 while(!feof($fi)) { if($fo=fopen("/tmp/tmp.gif","w")) { while(!feof($fi)) { fwrite($fo,fread($fi,65535)); } fclose($fo); } } fclose($fi); } ?> -- Daniel Tryba -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php