| Liam Delahunty: Home | Tips | Web | Contact |
|---|
|
Recommended laptop
under £500. Think I deserve a present? See my Amazon Wish List |
Identifing the Googlebotgethostbyname & gethostbyaddrSeeing the post How to verify Googlebot post on the Official Google Webmaster Central Blog I'm looking into using gethostbyname & gethostbyaddr to help verify if the bot claiming to be Googlebot actually is. Firstly, the Googlebot will be listed as the User Agent so we can test all requests to the page using a simple if statement. So, from their post we know
// check if it's really the google bot and not some hideous spam thing.
Test result using known google IP of 66.249.66.1The word googlebot is found in the $name returned by the getHostByAddr(IP). (crawl-66-249-66-1.googlebot.com) The $host IP address getHostByName($name) for the getHostByAddr(IP) equals that given and has passed. (66.249.66.1) Your User Agent, IP Address, host by address and host by name$_SERVER['HTTP_USER_AGENT'] : CCBot/2.0 $_SERVER['REMOTE_ADDR']: 23.22.76.170 $name = gethostbyaddr($ip): ec2-23-22-76-170.compute-1.amazonaws.com $host = gethostbyname($name): 23.22.76.170 On my Online Sales site, I published a script that will email you when the Googlebot visits. See also: Share this! Php Gethostbyaddr | Php Gethostbyaddr Googlebot | Php Google Referer Link here: |