URL in a string

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nmotion
Forum Commoner
Posts: 32
Joined: Wed Jan 22, 2003 6:53 am

URL in a string

Post by nmotion »

Can find this anywhere...

I have different domain names on the same server. How do I detect which url is being used to see the page.
bjg
Forum Newbie
Posts: 15
Joined: Tue Jun 10, 2003 9:42 am
Location: .au

Post by bjg »

$_SERVER['HTTP_HOST']
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

You can find lots of useful things by doing:

Code: Select all

echo '<pre>';
print_r($_SERVER);
echo '</pre>';
Mac
User avatar
cactus
Forum Regular
Posts: 343
Joined: Tue Jun 10, 2003 4:16 am
Location: UK

Post by cactus »

Additionally, the use of phpinfo() to determine the superglobals elements is recommended, but may be disabled on some shared hosting systems :(

Regards,
Post Reply