saving a jpeg via HTTP

From: Date: Sat, 15 Jun 2002 15:15:42 +0000
Subject: saving a jpeg via HTTP
Groups: php.general 
Request: Send a blank email to php-general+get-102341@lists.php.net to get a copy of this message
What is the best way using only PHP to grab a image file off a website a d save it locally? I know I can use wget and this would be a piece of cake, but in this case I don't want to rely on external programs. 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. I was using fsockopen instead of file because I want to use the timeout feature of fsockopen. any help is appriciated. -- Jeff Bearer, RHCE Webmaster, PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper

« previous php.general (#102341) next »