Re: [PHP] saving a jpeg via HTTP
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 :) -- Daniel Tryba -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] saving a jpeg via HTTP
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: -- Daniel Tryba -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] saving a jpeg via HTTP
Perhaps you could try a cURL or some other FTP approach? - Original Message - From: Jeff Bearer Sent: Saturday, June 15, 2002 11:16 AM To: [EMAIL PROTECTED] Subject: [PHP] saving a jpeg via HTTP 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.phpGet more from the Web. FREE MSN Explorer download : http://explorer.msn.com
[PHP] saving a jpeg via HTTP
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php