problems with fread and binary info

From: Date: Wed, 19 Jul 2000 21:28:05 +0000
Subject: problems with fread and binary info
Groups: php.general 
Request: Send a blank email to php-general+get-7340@lists.php.net to get a copy of this message
I am using php4pl2. I am using the cgi version with apache. I have found I am not alone in problems related to pulling graphics off of webpages and trying to store them locally. I just haven't found a workaround. To illustrate the problem let me show you some code: <?php header("Content-type: image/gif"); $image_file=fopen("http://images.amazon.com/images/P/0070131430.01.MZZZZZZZ.gif",'rb'); echo fread($image_file,-1); ?> will make the browser display the image I want happily on the browser. You might be suprised that this then does not work: <?php header("Content-type: image/gif"); $image_file = fopen("http://images.amazon.com/images/P/0070131430.01.MZZZZZZZ.gif",'rb'); $image_data = fread($image_file,-1); echo $image_data; ?> Any ideas? I've tried this for two days now.

« previous php.general (#7340) next »