Forum Moderators: coopster

Message Too Old, No Replies

Finding the server IP address

really easy question but can't find the answer

         

cazgh

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

10+ Year Member



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

eelixduppy

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



Predefined Variables [us3.php.net]


echo $_SERVER['SERVER_ADDR'];

Good luck!

cazgh

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

10+ Year Member



No - not giving me anything...

Thanks for trying :(

eelixduppy

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



What version of PHP do you have?

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

coopster

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

WebmasterWorld Administrator 10+ Year Member



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.

cazgh

10:55 am on Nov 15, 2006 (gmt 0)

10+ Year Member



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!