Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!fu-berlin.de!uni-berlin.de!not-for-mail From: "M. Strobel" Newsgroups: comp.lang.php Subject: Re: Headers in fpassthru() output Date: Tue, 07 Feb 2012 09:56:14 +0100 Lines: 32 Message-ID: <9pc79eF1loU1@mid.uni-berlin.de> References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: news.uni-berlin.de xPusgWo2YL23ELZV7njcNwcJaGk76ojCx3hRqRdimsf6kRYVw= User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.24) Gecko/20111101 Thunderbird/3.1.16 In-Reply-To: Xref: x330-a1.tempe.blueboxinc.net comp.lang.php:4754 Am 07.02.2012 03:40, schrieb Michael T. Davis: > So far, I've tested a call to fopen followed by a call to fpassthru > on a remote (http://...) JPEG file with PHP v4.4.7 in the "OSU Web Serv= er" > running under OpenVMS V8.3 on an Alpha, and with PHP v5.3.4 in Apache v= 2.2.17 > running under Mac OS X v10.6.8. The JPEG file is served by a Webcam. = The > documentation (on php.net) for "http://" says the stream opened by fope= n only > provides access to the body of the response. Why is it, then, that whe= n I > call on fpassthru for the (JPEG URL) stream, I see the headers included= in the > data returned? >=20 > The code looks basically like this: >=20 > $image =3D fopen ( "http://...jpg", "r" ); > foreach ( $http_response_header as $header ) > { > echo "{$header}\r\n"; You should not echo the headers, this will send your web server=E2=80=99s= headers, and as body your echoed headers. Use header() function instead - http://de.php.net/manual/de/function.hea= der.php /Str.