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 #176944 is a reply to message #176942] Wed, 08 February 2012 10:38 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 18:35, schrieb Michael T. Davis:
> In article <9pd32eFlgeU1(at)mid(dot)uni-berlin(dot)de>, "M. Strobel"
> <sorry_no_mail_here(at)nowhere(dot)dee> writes:
>
>> Am 07.02.2012 17:36, schrieb Michael T. Davis:
>>
>>> I didn't claim that $http_response_header was invalid. As I
>>> mentioned in the parenthetical at the end of the original post, I'm trying
>>> to serve the JPEG image of a network Webcam from the host where I have the
>>> PHP script, in order to make it appear as if the JPEG image comes from the
>>> PHP-running host. This means I need to send the headers that come from
>>> the response of the Webcam to the browser. I can certainly leverage
>>> $http_response_header and push the contents to the broswer, but if I do
>>> that--given the behavior I'm seeing--it seems I would still need to parse
>>> the headers from the fopen call and "drop them on the floor" before sending
>>> the "actual" body/image of what comes from the Webcam. If I'm going to
>>> parse the headers, I figured I might as well do something with them, which
>>> is why the work-around doesn't call on $http_response_header.
>> --cut
>>>
>>> Regards,
>>> Mike
>>
>> This does not sound like you read and understood my answers.
>>
>> Drop your workaround, and start sending the headers with the header()
>> function u
>
>>
> sing
>> $http_response_header.
>
> OK, this was my original code:
>
> $image = fopen ( "http://...jpg", "r" );
> foreach ( $http_response_header as $header )
> {
> echo "{$header}\r\n";
> }
> echo "\r\n";
> fpassthru ( $image );
> fclose ( $image );
>
> The issue was apparently my use of `echo' to send the headers to the
> browser. I took your direction literally, and it seems to work:
>
> $image = fopen ( "http://...jpg", "r" );
> foreach ( $http_response_header as $header )
> {
> header ( $header );
> }
> fpassthru ( $image );
> fclose ( $image );
>
> As I thought about it, my mistake was clear.
>
>>
>> /Str.
>
> Thanks,
> Mike

:-0

Once you've got this you could proceed to optimize the headers / write your own -
cache? content-type?

/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 09:24:41 GMT 2024

Total time taken to generate the page: 0.05269 seconds