Is it possible to check if a user already likes my facebook fanpage from my website with Javascript or PHP? without that user doesn't need to authenticate / allow some persmissions first? Thanks more. I tried other suggestions found on this site but do not work
You have to authenticate the user first, simply use the JS SDK. You can then use the output from the likes endpoint to see if your page is there.
There is no other way because you are accessing sensitive information about a user.
The only way to check if a user already likes a fanpage is by authorizing the user with the user_likes
permission and accessing the /me/likes
endpoint. Without authorization, it is impossible.
Btw, you are not allowed to gate content behind a like, require it to take part in a promotion, or reward users in any way for liking a page:
Only incentivize a person to log into your app, enter a promotion on your app’s Page, or check-in at a place. Don’t incentivize other actions.