Jump to content

How can I detect a search engine spider using PHP


physaux

Recommended Posts

Hey guys, I am making a site where certain content will be limited to "members only", where membership is free. Now I want the google bot or whatever bot to be able to see and index this content, but when a user visits it, I want to hide it from them unless they are a member (I already do that). So basically I want to have a function that I can call that will return true or false if the current page is being requested by a search engine spider. I know it's possible because I regularly see forums doing that; posts are hidden unless you register but if you look through the google cached version, the posts are visible. How can I do that?

 

so far all I have is the following, so that the rest of my code works.

function is_spider(){

return true;
}

 

I read a http://iarematt.com/how-to-detect-a-search-engine-spidercrawler-with-php/ which talks about this, but I don't really trust it...

 

What do you guys think, How can this be done?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.