Question

I'm developing this Facebook Application and I was wondering if it's possible (and how) to programmatically, through the Facebook PHP Graph API, press some 'Like' button on some page?

Of course, this is optional on my application... I'm still not ready to really explain what application I'm doing, but it would be interesting to code such a feature.

Is it possible somehow?

Was it helpful?

Solution

You cannot do this. Facebok wont let you do a POST to /POST_ID/likes, you can only do a get request to retrieve their likes. What you are trying to do is a violation of facebook's TOS. I would suggest just adding a like button and "forcing" them to like before they continue with your application. However, in my opinion even that is kind of silly because they can instantly go unlike it after they have used your application.

OTHER TIPS

By your description it sounds like you're trying to get a user to like something without the users knowingly clicking a like-button. This sort of interaction is not condoned by Facebook, I think. There are various black-hatty ways to accomplish this though, one fairly elaborate one is descriped here: http://www.liquidrhymes.com/2010/08/25/smoking-hot-bartender-is-some-smoking-hot-facebook-spam/

UPDATE Sorry, I might be wrong. If you get stream_publish extended permissions from the user, you might be able to like posts on their behalf by doing a POST to /POST_ID/likes. See Publishing to Facebook in http://developers.facebook.com/docs/api

i was looking for the same thing, but not to force a user into liking something, but actually for their own protection.

here is where i come from: on a web site (maybe on multiple pages) there is an "I Like" button, implemented as described by facebook.

each time a user goes to that page, the browser will make a request to facebook, throught the iframe that contains the button, providing all the info that we are used to from a web server log file.

if the user has in the past logged in facebook and not cleared the cache. the request will also contain the cookie indentifying the facebook user.

so even more then analytics, facebook know all about the user activity on those pages.

so i wanted the user to only give this info when they decide to.

my solution was to have a button (as graphic only) on the page. when the user clicks it a new frame should open and only there the facebook code should be executed.

obviously on the new frame i could not put the normal "i like" code, since that would require a 2nd click for the user. at this point i would need the "programmatically clicking of the i like button".

it is not an opengraph solution, but it works: the frame just does a redirect to http://www.facebook.com/share.php?u=URL

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top