如何以编程方式“按”一个“喜欢”通过 Facebook 应用程序按钮?
我正在开发这个 Facebook 应用程序,我想知道是否可以(以及如何)以编程方式通过 Facebook PHP Graph API 在某个页面上按“喜欢”按钮?
当然,这在我的应用程序中是可选的...我还没有准备好真正解释我正在做什么的应用程序,但编写这样的功能会很有趣。
有可能吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
根据您的描述,听起来您正试图让用户喜欢某些东西,而用户却没有故意点击“喜欢”按钮。我认为 Facebook 不会容忍这种互动。不过,有多种黑帽方法可以实现这一目标,这里描述了一种相当复杂的方法:http://www.liquidrhymes.com/2010/08/25/smoking-hot-bartender-is-some-smoking-hot-facebook-spam/
更新 抱歉,我可能是错的。如果您从用户那里获得了
stream_publish
扩展权限,您可以通过对/POST_ID/likes
执行POST
来代表他们对帖子点赞。请参阅 http://developers.facebook.com/docs/api 中的发布到 FacebookBy 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 aPOST
to/POST_ID/likes
. See Publishing to Facebook in http://developers.facebook.com/docs/api你不能这样做。 Facebok 不会让你对 /POST_ID/likes 执行 POST,你只能执行 get 请求来检索他们的点赞。您试图做的事情违反了 Facebook 的服务条款。我建议在他们继续您的申请之前添加一个“喜欢”按钮并“强迫”他们喜欢。然而,在我看来,即使这样也有点愚蠢,因为他们在使用你的应用程序后可能会立即变得不同。
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.
我一直在寻找同样的东西,但不是为了强迫用户喜欢某些东西,而是为了他们自己的保护。
这就是我的来源:在一个网站上(可能在多个页面上)有一个“我喜欢”按钮,按照 facebook 的描述实现。
每次用户访问该页面时,浏览器都会通过包含按钮的 iframe 向 facebook 发出请求,提供我们习惯于从 Web 服务器日志文件中获取的所有信息。
如果用户过去曾登录过 Facebook 并且未清除缓存。该请求还将包含识别 Facebook 用户的 cookie。
因此,Facebook 比分析更了解这些页面上的用户活动。
所以我希望用户仅在决定时提供此信息。
我的解决方案是在页面上有一个按钮(仅作为图形)。当用户单击它时,应该打开一个新框架,并且只有在那里才应该执行 facebook 代码。
显然,在新框架上,我无法放置正常的“我喜欢”代码,因为这需要用户第二次单击。此时我需要“以编程方式单击“我喜欢”按钮”。
它不是一个开放图解决方案,但它可以工作:框架只是重定向到
http://www.facebook.com/share.php?u=URL
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