Skip to content

E-LLP/php-verify-googlebot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

PHP Verify Googlebot

A simple class to verify GoogleBot. Detect GoogleBot for real!

Example

require_once __DIR__.'/VerifyGoogleBot.class.php';
$verify=New VerifyGoogleBot();

// Example with A manually assigned IP
$google_ip='66.249.66.1'; // Real Google Bot IP

if($verify->isGoogleBot($google_ip)){
    echo 'Yap! This is real Google Bot IP!';
}
else{
    echo 'Nope! This IP isn\'t real!!';
}

echo '<hr/>';

// Example to check if current user is Really GoogleBot

if($verify->isGoogleBot()){
    echo 'The client is really a Google Bot! :)';
}
else{
    echo 'Nope! This client is just a simple user :/';
}

Available Public Methods

// Detects if an IP is Google Bot's Ip
$ip='66.249.66.1';
$verify->isGoogleIP($ip);

// Detect Google Bot by useragent (if empty current ua will be used)
$useragent=$_SERVER['HTTP_USER_AGENT']
$verify->isGoogleIP($useragent);

// Get current user IP
echo $verify->getClientIP();

About

A simple class to verify GoogleBot. Detect GoogleBot for real!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages