NYCPHP Meetup

NYPHP.org

[nycphp-talk] crazy uses for header()

Chris Shiflett shiflett at php.net
Wed Feb 11 13:45:42 EST 2004


--- Chris Bielanski <Cbielanski at inta.org> wrote:
> There is a curiosity about the use of the header() function that the
> documentation cannot satisfy. I'm trying to find out if there is any
> way to trick the func into redirecting to a page a la:
> 
> header("Location: xyz.php?arg1=foo&arg2=bar");

Trick the function? The function simply sends a header to the Web client.
There is no trickery. It's up to you to make sure the header is formatted
correctly, so that the Web client will interpret it as you desire. An an
example, the Location header requires an absolute URL, so your example is
improper.

> But all my fiddling around seems to be fruitless. If header will not
> work for this operation - simple redirect with GET args

These "GET args" are simply part of the URL. The Location header only
requires an absolute URL - any valid one will do.

Hope that helps.

Chris

=====
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
     Coming mid-2004
HTTP Developer's Handbook - Sams
     http://httphandbook.org/
PHP Community Site
     http://phpcommunity.org/



More information about the talk mailing list