简体   繁体   English

Facebook 墙柱

[英]Facebook wall posts

I need some help please.我需要一些帮助。 I've been lost in the graph facebook documentation for the last 2 hours.在过去的 2 个小时里,我一直迷失在图表 facebook 文档中。 Please send an advice about how could I get my facebook wall posts/info, etc. .请发送有关如何获得我的 facebook 墙贴/信息等的建议。 . . ? ? I need an access token.我需要一个访问令牌。 I've tried in many ways to get it, but is useless.我已经尝试了很多方法来获得它,但没有用。 I don't understand how to build that url.我不明白如何构建 url。 . . . . Please, just tell me from where should I start?请告诉我我应该从哪里开始? Thank you!谢谢!

It's not very clear what you are trying to do or what language you are trying to do this in. But the graph api isn't very difficult to tackle if you follow their documentation.目前还不清楚您要做什么或您要使用什么语言来执行此操作。但是如果您按照他们的文档操作,图表 api并不是很难解决。 You need to first prompt the user to authenticate with your application and any extended permissions.您需要首先提示用户使用您的应用程序和任何扩展权限进行身份验证。 Then you can make calls to the graph api (or FQL queries if needed).然后,您可以调用图形 api(或 FQL 查询,如果需要)。

Here is a full example of getting Facebook wall posts like you asked.这是获取 Facebook 墙贴的完整示例,如您所问。 Reading wall posts will require the read_stream extended permission.阅读墙帖需要 read_stream 扩展权限。

<!DOCTYPE html>
<html>
<body>
<div id="fb-root"></div>
<a href="#" onclick="getFeed();return false;">Get Feed</a>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
  FB.init({ appId  : 'yourFacebookAppId', status : true, cookie : true, xfbml  : true });

  function getFeed() {  
    FB.login(function(response) {
      if (response.session && response.perms) {
        FB.api('/me/home',
          function(response) {
            alert(response.data.length);
            for (var i = 0; i < response.data.length; i++) { 
              alert("message from " + response.data[i].from.name + ": " + response.data[i].message);
            }
          }
        );
      }
    } , {perms:'read_stream'}); 
}
</script>
</body>
</html>

This can also be done in server code like PHP but for generic questions like this and first getting started the javascript api is probably the easiest until you know more of what you are trying to do.这也可以在像 PHP 这样的服务器代码中完成,但是对于像这样的一般问题和第一次开始使用 javascript api 可能是最简单的,直到你知道更多你想要做什么。

https://developers.facebook.com/docs/authentication/ https://developers.facebook.com/docs/authentication/

Facebook Platform uses the OAuth 2.0 protocol for authentication and authorization. Facebook平台使用OAuth 2.0协议进行认证和授权。 We support a number of different OAuth flows that you can use within your Website, mobile and desktop apps.我们支持多种不同的 OAuth 流程,您可以在您的网站、移动和桌面应用程序中使用这些流程。

This document outlines that different mechanisms Facebook Platform uses to support each of these flows.本文档概述了 Facebook 平台用于支持这些流程的不同机制。 The examples in this document use PHP for server-side programming and HTML/JavaScript for client-side code.本文档中的示例使用 PHP 进行服务器端编程,使用 HTML/JavaScript 进行客户端代码。 These examples are very straightforward and easily translatable to other languages.这些示例非常简单明了,可以轻松翻译成其他语言。

This is where you need to start.这是您需要开始的地方。

try this one https://graph.facebook.com/USER_ID/feed?access_token=TOEKN Just replace the USER_ID and TOKEN with the users id and access_token and you'll get a list of all the wall posts in a json format and also you can navigate the result page using the Previous and Next link at the bottom. try this one https://graph.facebook.com/USER_ID/feed?access_token=TOEKN Just replace the USER_ID and TOKEN with the users id and access_token and you'll get a list of all the wall posts in a json format and also您可以使用底部的上一个下一个链接导航结果页面。

Hope that will solve your problem.希望这能解决您的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM