REQUEST_URI

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

REQUEST_URI

Post 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
Post Reply