Page 1 of 1

REQUEST_URI

Posted: Mon Oct 19, 2009 10:16 pm
by alex.barylski
I just echo'ed $_SERVER['REQUEST_URI']; and to my surprise it is void of the scheme, domain, etc.

Basically it only returns the request path, query string, etc...

Easy enough to fix I can just throw the code into a function and call it, but I was kind of expecting the whole thing as the URI according to most formal definitions does include the whole string:

Code: Select all

 
  foo://username:password@example.com:804 ... erret#nose
  \ /   \________________/\_________/ \__/            \___/ \_/ \_________/ \_________/ \__/
   |           |               |       |                |    |       |           |       |
   |       userinfo         hostname  port              |    |       parameter query  fragment
   |    \_______________________________/ \_____________|____|____________/
scheme                  |                               | |  |
   |                authority                           |path|
   |                                                    |    |
   |            path                       interpretable as filename
   |   ___________|____________                              |
  / \ /                        \                             |
  urn:example:animal:ferret:nose               interpretable as extension
 
Is there another variable I should be using perhaps? Just so my function works entirely as expected, what combination of variables do I concatenate to form a fully qualified URI?

HOST_NAME
QUERY_STRING
REQUEST_URI

What? Any special conditions?

Cheers,
Alex