FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Headers in fpassthru() output
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Headers in fpassthru() output [message #176937 is a reply to message #176934] Tue, 07 February 2012 08:56 Go to previous messageGo to previous message
M. Strobel is currently offline  M. Strobel
Messages: 386
Registered: December 2011
Karma:
Senior Member
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 Server"
> running under OpenVMS V8.3 on an Alpha, and with PHP v5.3.4 in Apache v2.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 fopen only
> provides access to the body of the response. Why is it, then, that when I
> call on fpassthru for the (JPEG URL) stream, I see the headers included in the
> data returned?
>
> The code looks basically like this:
>
> $image = 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’s headers, and as
body your echoed headers.

Use header() function instead - http://de.php.net/manual/de/function.header.php

/Str.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Tips to find Technical Co-founder / Tech lead
Next Topic: 6 line php 2 asp
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 22:48:37 GMT 2024

Total time taken to generate the page: 0.03908 seconds