Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I need to find out my web hosting server's IP address. Its on a shared hosting server and from experience, it's usually not the same as the incoming IP address that you would get by just pinging the domain name. Is there a php script I can run or something to find our the outbound IP address my website is using when connecting to a SMTP server for example?

share|improve this question
Who is the host? – SgtOJ Nov 28 '10 at 12:31

4 Answers 4

You could do a web request from code (PHP or other) and request a URL such as and save it as a file that you open and look at.

Reading Remote URL HTML Source in PHP shows some examples. If your PHP installation allows for it, then this could be as simple as creating a file with the following, and then point your browser to it:

  // See for the exact URL
  echo file_get_contents(
share|improve this answer
See also which currently refers to for use in scripts. – Arjan Nov 28 '10 at 12:47
Awesome answer, but that URL ( doesn't work anymore. Why not just leave it as Then you'll see the same page you would see if you navigated there in your browser, except with the server's IP instead of yours. – regularmike Oct 22 '13 at 16:24

I have success when I try

curl -s

Or with PHP:

echo file_get_contents("");
share|improve this answer

I think you are looking for this...

<?php echo $_SERVER['SERVER_ADDR']; ?>

share|improve this answer

The host server outbound IP address is the one you see when you ping it, regardless of whether the shared host is name or IP based.

  • For name based shared hosts (all websites share the same IP), the user agent will add the hostname to its requests, which will allow the server to determine which website to show.

  • For IP based shared hosts (each website has its own IP), name resolution is straightforward.

If you are looking instead for the internal IP address used by your server in its network, this information can be accessed by connecting to your server through a secure shell, which most web hosts provide.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.