Question

I've tried the following on IP addresses with user agents claiming to be the Baidu search engine. Unfortunately Just Host's DNS servers refuse to return anything but the IP address for the host.

<?php
echo 'host: '.gethostbyaddr('180.76.5.168');
echo '<br />'.shell_exec('host -W 2 180.76.5.168');
echo '<br />'.shell_exec('nslookup 180.76.5.168');
?>

Any suggestions for how to get a hold of the host name for Baidu? I've thought about trying to reference specific DNS servers if possible though I'm not sure how to do that with PHP.


Quoted output of my localhost result...

host: baiduspider-180-76-5-168.crawl.baidu.com

Server: Wireless_Broadband_Router.home Address: 192.168.1.1 Name: baiduspider-180-76-5-168.crawl.baidu.com Address: 180.76.5.168

Was it helpful?

Solution

I was able to use a different DNS server via the host command via shell...

$p = trim(trim(explode(' pointer',shell_exec('host -W 2 180.76.5.168  68.238.96.12'))[1]),'.');
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top