Is there any way, with PHP, to check if the server access is being done by a bot / facebook bot?
Is there any way, with PHP, to check if the server access is being done by a bot / facebook bot?
According to this gringo OS answer :
if (
strpos($_SERVER["HTTP_USER_AGENT"], "facebookexternalhit/") !== false ||
strpos($_SERVER["HTTP_USER_AGENT"], "Facebot") !== false
) {
// é provavelmente um bot do facebook
}
else {
// nao eh um bot Facebook
}
The complete list is here but these two are the most used.