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 #176942 is a reply to message #176941] Tue, 07 February 2012 17:35 Go to previous messageGo to previous message
DAVISM is currently offline  DAVISM
Messages: 3
Registered: February 2012
Karma:
Junior Member
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
[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: Mon Nov 25 00:29:37 GMT 2024

Total time taken to generate the page: 0.04692 seconds