Welcome to WebmasterWorld Guest from 35.175.120.174

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Finding the server IP address

really easy question but can't find the answer

     
5:24 pm on Nov 10, 2006 (gmt 0)

Junior Member

10+ Year Member

joined:Feb 17, 2003
posts:76
votes: 0


Can anybody tell me if there is another way to retrieve the server ip address?

I'm trying $SERVER_ADDR but it isnt working and I can't find another way of doing it. Have searched and searched but must not be using the right key words.

Thanks for your help,

Caz

6:08 pm on Nov 10, 2006 (gmt 0)

Senior Member

joined:Nov 12, 2005
posts:5967
votes: 0


Predefined Variables [us3.php.net]


echo $_SERVER['SERVER_ADDR'];

Good luck!

9:35 am on Nov 13, 2006 (gmt 0)

Junior Member

10+ Year Member

joined:Feb 17, 2003
posts:76
votes: 0


No - not giving me anything...

Thanks for trying :(

11:49 am on Nov 13, 2006 (gmt 0)

Senior Member

joined:Nov 12, 2005
posts:5967
votes: 0


What version of PHP do you have?

You may have to use $HTTP_SERVER_VARS['SERVER_ADDR']

3:23 pm on Nov 14, 2006 (gmt 0)

Administrator

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 31, 2003
posts:12555
votes: 3


Also depends on the HTTP Server. Are you running Apache? IIS? Server variables can be hit and miss so you'll want to read through the link provided carefully as well as the associated links from that page.
10:55 am on Nov 15, 2006 (gmt 0)

Junior Member

10+ Year Member

joined:Feb 17, 2003
posts:76
votes: 0


Its sorted! Thanks for your suggestions.

This is for a very beginners php course I am doing and the teach finally came back to me to explain that this functionality has been blocked on their server and that they use a dynamic IP so it can't be read.

It was a trick question and we were supposed to give server name instead.

Doh!