Jump to content

How to get server IP address


abdfahim

Recommended Posts

I think this is pretty simple ...

I know that I can get user IP by

echo $_SERVER['REMOTE_ADDR'];

 

But how can I display server IP (The IP user needs to enter on the address bar of the browser to access the website.

 

..... I know the question is wired but believe me I need it.

Link to comment
Share on other sites

wait .. I think I am making u confused ... I am trying to explain it more ...

let my server's IP is 150.160.170.180 ... When i use the code

echo $_SERVER['SERVER_ADDR'];

in a php page, any visitor visits my page will see this IP address - 150.160.170.180. But if I visit my page from the server itself from localhost, it will definite show 127.0.0.1. But I need to show the external IP of my server page, as my server has a dynamic IP address, so that anyone can just come to the server and note its current IP in case the IP had changed. By the way, its a small home network.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.