If you have various password protected pages on your website, but want people to Like your pages (via Facebook), there is a simple trick you can use to allow this. You can detect the Facebook Scraper by its User Agent and serve up an alternative page that contains the OpenGraph markup you would like to use.
In PHP the code would look something like:
The User Agent from Facebook is:
facebookexternalhit/1.1 (+https://www.facebook.com/externalhit_uatext.php)
Hi,
Your solution it´s not working for me.
I´m trying to share custom content but i always get the Open Graph error 200, it doesn´t bypass the custom login system.
Any ideias?
Regards,
This has nothing to do with OpenGraph API calls. If you noticed, no Ope Graph API calls are bring made in the code. It’s purely to detect if Facebook is scraping your pages for content. Sharing content is covered in another article on my blog – please refer to that.
Thank you for the reply,
I read your article but not sure how can i share content if there´s a custom login system, that is my big problem.
Regards,
You need to use the code in this article together with the code in the “Facebook API: Posting a Status Update” article.