Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #4761
| From | "M. Strobel" <sorry_no_mail_here@nowhere.dee> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: Headers in fpassthru() output |
| Date | 2012-02-08 11:38 +0100 |
| Message-ID | <9pf1lqFmecU1@mid.uni-berlin.de> (permalink) |
| References | <jgq2u7$unn$1@news1.cse.ohio-state.edu> <jgqr6d$dlh$1@dont-email.me> <jgrju2$uqv$1@news1.cse.ohio-state.edu> <9pd32eFlgeU1@mid.uni-berlin.de> <jgrnca$13b$1@news1.cse.ohio-state.edu> |
Am 07.02.2012 18:35, schrieb Michael T. Davis:
> In article <9pd32eFlgeU1@mid.uni-berlin.de>, "M. Strobel"
> <sorry_no_mail_here@nowhere.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.
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Headers in fpassthru() output DAVISM@ecr6.ohio-state.edu (Michael T. Davis) - 2012-02-07 02:40 +0000
Re: Headers in fpassthru() output "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-02-07 09:48 +0100
Re: Headers in fpassthru() output "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-02-07 09:56 +0100
Re: Headers in fpassthru() output "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2012-02-07 10:34 +0100
Re: Headers in fpassthru() output DAVISM@ecr6.ohio-state.edu (Michael T. Davis) - 2012-02-07 16:36 +0000
Re: Headers in fpassthru() output "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-02-07 17:50 +0100
Re: Headers in fpassthru() output DAVISM@ecr6.ohio-state.edu (Michael T. Davis) - 2012-02-07 17:35 +0000
Re: Headers in fpassthru() output "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-02-08 11:38 +0100
Re: Headers in fpassthru() output "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2012-02-08 10:10 +0100
csiph-web