Reputation: 29
$ host 64.34.119.12 12.119.34.64.in-addr.arpa domain name pointer stackoverflow.com.
How is this Carried out in php? I am planning to do lookup for searching Google's ip. How do i do implement this?
Like in above example it is stalkoverflow.com
I want to determine their netblock and do strstr on their netblock for "google"
if it is matched, it will , echo "Yeah , its google"
Upvotes: 0
Views: 2956
Reputation: 1950
Your looking for gethostbyaddr(string ip_address)
, see: http://php.net/manual/en/function.gethostbyaddr.php
Example:
<?php
$hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
echo $hostname;
?>
Upvotes: 3