Re: fsockopen to spit out the HTTP's Location...
| From: | Chris Shiflett | Date: | Tue, 23 Mar 2004 18:38:06 +0000 |
| Subject: | Re: fsockopen to spit out the HTTP's Location... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-181298@lists.php.net to get a copy of this message | ||
--- Scott Fletcher <scott@abcoa.com> wrote:
> Sigh! Well, I guess all web browsers suck at it by the way!
Suck at what exactly?
> Michal Migurski from other posting had explained that fsockopen()
> do the TCP stuff or the Transport Layer. So, no wonder fsockopen()
> can't get to the Network layer, like the IP Address stuff.
What do you consider to be the network layer? This figure might be helpful
to you:
http://shiflett.org/images/18fig06.jpg
> I don't want to use cURL because it take more time.
A better reason is that it also cannot make a connection to a remote
client.
> And finally, for those of you who are dying to know the answer to
> why I can't use the header(). It's the 3rd party coding that contain
> the code,
>
> --snip--
> if(headers_sent())
> $this->Error(' **** ');
> --snip--
Yeah, this is why everyone was interested - you're wrong. :-)
That code will throw an error is headers have already been sent. Headers
are sent as soon as output begins, so you can either set all of your
headers prior to any output or use output buffering with ob_start().
So, use header().
Hope that helps.
Chris
=====
Chris Shiflett - http://shiflett.org/
PHP Security - O'Reilly
Coming Fall 2004
HTTP Developer's Handbook - Sams
http://httphandbook.org/
PHP Community Site
http://phpcommunity.org/