For smart Primates & ROBOTS (oh and ALIENS ).

Blogroll

Wednesday, October 14, 2015

how to check if visitor is a robot or bot

Problem:

how to check if visitor is a robot or bot?

Solution:

Please use below code

Example:

$user_agent='';
if( !isset( $_SERVER['HTTP_USER_AGENT'])){
echo 'i m a Robot!';
die();
} else {
$user_agent=strtolower($_SERVER['HTTP_USER_AGENT']);
}

$robot='N';
if(strpos($user_agent,'bot')>0 || strpos($user_agent,'Bot')>0) {
    $robot='Y';
}

if($robot!='Y')
echo 'I am not a Robot';
else
echo 'I am a Robot';




Share:

0 comments:

Post a Comment

Unable to resolve <website url> Try checking the for validity Google Pagespeed Insights

Unable to resolve <website url> Try checking the for validity Google Pagespeed Insights   You have a website and want to test it'...

Ads Inside Post

Powered by Blogger.

Arsip