> > If readfile is indeed that "broken", maybe we can talk the
> > powers that be into dumping full HTTP headers through the
> > readfile call in a future version.... I mean, the main
> > script has it already from when it was called... so it
> > should be able to sub-call pages in that same context.
>
> readfile() is not broken at all.

"broken" was in quotes for a reason... yes, it works the way the docs say -
but it doesnt work well enough in light of the fact that virtual gives me
garbage.

If I do a browser based connect to that SHTML file, I'll get a IE based
response when I use IE, and a Netscape response when I use Netscape.

If I do a readfile() request to that SHTML file through PHP3.0.15, I ALWAYS
get a Netscape based response, even when the calling PHP3 knows that it was
called from an IE browser.  This is no doubt due to the HTTP 1.0 connection
used (To quote the online PHP manual:)

        If filename begins with "http://" (not case sensitive),
        an HTTP 1.0 connection is opened to the specified server
        and the text of the response is written to standard output.

This is nice, and things like .CGI's and other scripts can be used this
way - but not completely transparently as can be seen in my case (and this
will of course fail when referencing a name-based host... something thats
becoming more and more prevalent these days).

But obviously it's not a FULL HTTP 1.0 connection - other wise it would have
a

        User-Agent:

line in the request header, wouldnt it?

> It is silly to use readfile() to access the local server.
> virtual() does that just fine.  Having readfile() lie about
> the browser type that it is and send along fake headers  would
> not be a good idea.  If you want to do something like that use
> fsockopen() and connect to port 80 of your server and send all
> the fake headers you want.

I tried virtual - but in doing so, I lost everything except what preceeded
the virtual call (which is pretty much right at the top of the page, being
as it calls the standard page headers/formatting).

This made virtual useless to me, on my server (running php3.0.15 - maybe it
works better under 4, but I dont have that option right now)

Include doesnt work, as it doesnt process the SHTML, require also doesnt do
what I need.

Thus readfile() (even if it's not the best idea) actually worked better than
any of the more desirable alternatives.

So it looks like I will have to use the fsockopen() method - since the
"non-broken" readfile() routine doesnt handle User-Agent properly.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to