PHP Classes
elePHPant
Icontem

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    
Last Updated Ratings Unique User Downloads Download Rankings
2016-08-03 (2 months ago) RSS 2.0 feedStarStarStarStar 70%Total: 263 This week: 3All time: 7,288 This week: 377Up
Version License PHP version Categories
kalmargabor 1.0.0MIT/X Consortium ...5Networking, PHP 5, Searching
Description Author

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 google.com or googlebot.com.

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
Innovation award
Innovation award
Nominee: 1x

Details

Install

Composer

composer require kalmargabor/crawler-check

Examples

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

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

var_dump($crawlerCheck->isValid($ipToCheck));

  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 README.md 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  
 100%
Total:263
This week:3
All time:7,288
This week:377Up
 User Ratings  
 
 All time
Utility:100%StarStarStarStarStarStar
Consistency:100%StarStarStarStarStarStar
Documentation:100%StarStarStarStarStarStar
Examples:-
Tests:-
Videos:-
Overall:70%StarStarStarStar
Rank:339