-
Contributing Member
IP address
I want to get ip address. How can I get it or what functions or methods can be used to get ip address using PHP
Timmy
-
Contributing Member
Re: IP address
You can use REMOTE_ADDR or REMOTE_HOST to achieve the above that is get ip address. But I want to know about super global variables in php. Someone throw highlight on this.
-
Junior Member
Re: IP address
$_SERVER variable are super global variable in php....
-
Junior Member
-
Junior Member
Re: IP address
baria Mahesh::
you will use this code for getting ip address which is given below::
$ip = gethostbyname('www . example . com');
$out = "The following URLs are equivalent:
\n";
$out .= '[[siteurl]], http://' . $ip . '/, and http://' . sprintf("%u", ip2long($ip)) . "/
\n";
echo $out;
?>
ip2long() function given to you ip address or particular given hostname.
-
Junior Member
Re: IP address
If you want the IP adreess than use gethostbyaddr() & if you want to url than use gethostbyname() function.
-
Junior Member
Re: IP address
u can use
$ip=getHostByName(@"REMOT_ADDR");
i thinks its work...
-
Junior Member
Re: IP address
It is better to use REMOTE_ADDR
$ip = $_SERVER['REMOTE_ADDR'];
-
Junior Member
Re: IP address
If you want to fetch IP address using PHP than you have to use Given Code:
$ip=@$REMOTE_ADDR;
echo "IP Address= $ip";
Detecting the IP address is very important requirement for many scripts where we store the members or visitors details.
-
Junior Member
Re: IP address
For finding ip address make use of the website for free of cost.Also you can get the DNS query, hosting, and ping test information from the website.For normal PC(personal computer) IP address you can find by giving ping in the command prompt.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules