2

I am looking for full set of IP info like Hostname, reverse dns, IP owner etc.

<?php

$ip       = $_SERVER['REMOTE_ADDR'];
$hostname = php_uname('n');
echo "<br>" . $hostname;

echo "<br>" . $ip;


?>


 $hostname = php_uname('n');

This is returning my Servers hostname not visitors, hostname. I also need other info, like Reverse DNS , ISP etc

Are there any Free Apis Available for this lookup?

Solutions i considered, How do I retrieve the visitor's ISP through PHP?

Not working now!

Community
  • 1
  • 1
  • possible duplicate of [How to Generate IP Details using Php?](http://stackoverflow.com/questions/10428830/how-to-generate-ip-details-using-php) – hakre May 03 '12 at 09:51

2 Answers2

2

You are looking for gethostbyaddr($ip).

php_uname is like uname on the command line => it always uses the system's hostname.

ThiefMaster
  • 310,957
  • 84
  • 592
  • 636
0
$clientIp =  $_SERVER['REMOTE_ADDR'];
$clientDns = gethostbyaddr($clientIp);
$clientISP = geoip_isp_by_name($clientIp);

geoip_* requires the pecl Geoip extension and a free database from maxmind

Frank Farmer
  • 38,246
  • 12
  • 71
  • 89