PHP Classes

PHP Detect Google Crawler: Check if an access is from Google checking its IP

Recommend this page to a friend!
  Info   View files Documentation   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 70%Total: 355 All time: 6,949 This week: 71Up
Version License PHP version Categories
kalmargabor 1.0.0MIT/X Consortium ...5Networking, PHP 5, Searching


This class can check if an access is from Google checking its IP.

It takes a given IP address and verifies if it is from Google Bot.

The class determines the IP address host name and compares with or

Innovation Award
PHP Programming Innovation award nominee
August 2016
Number 11
Google is the most popular search engine. Being well ranked on Google is important for many sites to get nice organic traffic.

Many sites try to serve content for Google crawler bots as fast as possible, so that increases the chances of the sites pages to rank well.

In theory it is easy to detect when the Google bot is accessing a Web page. It is usually a matter of detecting the user agent string sent with requests from the Google bot crawler.

However, there are crawlers and malicious bots that pretend to be the real Google bot faking its user agent string.

This class provides a more robust way to detect whether a request is coming from Google bot or not.

It just gets the HTTP client IP address and resolves its host name to verify if it really has one of the known Google bot domains.

Manuel Lemos
Picture of Gábor Kalmár
Name: Gábor Kalmár <contact>
Classes: 1 package by
Country: Hungary Hungary
Age: ???
All time rank: 367835 in Hungary Hungary
Week rank: 195 Up2 in Hungary Hungary Up
Innovation award
Innovation award
Nominee: 1x




composer require kalmargabor/crawler-check


$crawlerCheck = new \Kalmargabor\CrawlerCheck\CrawlerCheck();

$ipToCheck = 'ip.address.ip.address';


  Files folder image Files  
File Role Description
Files folder imagesrc (1 directory)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file Doc. Documentation

  Files folder image Files  /  src  
File Role Description
Files folder imageCrawlerCheck (1 file)

  Files folder image Files  /  src  /  CrawlerCheck  
File Role Description
  Plain text file CrawlerCheck.php Class Class source

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:6,949
This week:71Up
 User Ratings  
 All time