1
exbanious
Returning url string in IIS
  • 2005/3/13 1:16

  • exbanious

  • Not too shy to talk

  • Posts: 113

  • Since: 2004/5/30


Does anyone know what the syntax might be for
getting the url and query string in IIS?

In Apache, this worked:
Quote:

$url = "http://".$_SERVER{'HTTP_HOST'}.$_SERVER{'REQUEST_URI'};


For IIS, I can't figure out a substitute for 'REQUEST_URI'.

2
jdseymour
Re: Returning url string in IIS

Looks like someone else was searching for the same as you.

The following is copied from a forum post. Hope it helps.

Just add this line in some initialization section:

$HTTP_SERVER_VARS['REQUEST_URI'] = ( isset($HTTP_SERVER_VARS['REQUEST_URI']) ? $HTTP_SERVER_VARS['REQUEST_URI'] : $HTTP_SERVER_VARS['SCRIPT_NAME'] . (( isset($HTTP_SERVER_VARS['QUERY_STRING']) ? '?' $HTTP_SERVER_VARS['QUERY_STRING'] : '')));

3
exbanious
Re: Returning url string in IIS
  • 2005/3/13 2:22

  • exbanious

  • Not too shy to talk

  • Posts: 113

  • Since: 2004/5/30


thanks for the quick reply.
unfortunately it didn't seem to work, but i was able to find something that did in another forum.
For the unfortunate IIS user's future reference, with some slight modification, this will return the query string only.

if(!isset($_SERVER['REQUEST_URI'])) {
$_SERVER['REQUEST_URI'] = substr($_SERVER['argv'][0], strpos($_SERVER['argv'][0], ';') + 0);
}

4
Dave_L
Re: Returning url string in IIS
  • 2005/3/13 5:18

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


You could also run this script to see what variables are provided, and what their values are:

() ?>


You could pass it some dummy query string parameters to see where they show up:

http://example.com/phpinfo.php?xxx=yyy&zzz=www

It's best to hide or protect that script so that others can't access it.

Login

Who's Online

189 user(s) are online (104 user(s) are browsing Support Forums)


Members: 0


Guests: 189


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Oct 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits