简体   繁体   English

从我的Facebook墙上获取私人帖子

[英]Getting private posts from my Facebook wall

First off: I googled and tried complete a day but only running circles. 首先,我用Google搜索并尝试完成了一天,但只运行了一个圈子。 When searching google for my problem I got plenty forum-posts and articles which seem to be described the same way as I would describe my problem. 在Google搜索我的问题时,我收到了很多论坛帖子和文章,它们的描述方式与我描述问题的方式相同。 But their solution goes another way. 但是他们的解决方案却是另一种方式。

So what I actually want to do is very easy: 所以我实际上想做的很简单:

Most of my Status Posts on Facebook are private for stared friends only but some of these posts go out to all my friend because they are some kinda fuzzy blog posts which are totally insensitive so I don't care if the public may see them. 我在Facebook上的大多数状态帖子都是私密的,只供被凝视的朋友使用,但是其中一些帖子对我所有朋友都是不公开的,因为它们是一些模糊的博客帖子,完全不敏感,因此我不在乎公众是否会看到它们。

Well. 好。 I got a self written PHP Homepage which I would like to print some of the posts I've written on my Facebook-wall. 我有一个自己写的PHP主页,我想在我的Facebook墙上打印一些我写的帖子。 These posts are not public on Facebook but shall be printed (in filtered form) on my Homepage. 这些帖子未在Facebook上公开,但应在我的主页上打印(以过滤形式)。

That's all. 就这样。 I can't get this to work (fetching posts). 我无法使它正常工作(获取帖子)。

I tried the api explorer (fb-dev-tool) to see how the access tokens work and just tried to use the generated token. 我尝试使用api资源管理器(fb-dev-tool)来查看访问令牌的工作方式,并尝试使用生成的令牌。 Works fine... for an hour, till the token expires... 正常工作...一个小时,直到令牌过期...

So I found blog posts telling me to create a private facebook app. 因此,我发现博客文章告诉我创建一个私人Facebook应用。

I did so, but this App is only allowed to read my profiles public data... stuff like posts to public walls (of other people or companies) or public likes... 我是这样做的,但是这个应用程序只允许读取我的个人资料的公开数据...诸如张贴到(其他人或公司的)公开墙上的信息或喜欢公众的信息...

I now don' even know if creating a app was the right way for my purpose but user access tokens (which seem to be the right point for solving my problem) seem to always expire after ~one hour. 我现在什至不知道创建应用程序是否是达到我目的的正确方法,但是用户访问令牌(似乎是解决我的问题的正确点)似乎总是在一个小时后过期。

So if using an app would be the right way, I need to know how to associate my profile with this (own) app or grant the rights to access the private wall posts. 因此,如果使用某个应用程序是正确的方法,那么我需要知道如何将我的个人资料与此(自己的)应用程序关联或授予访问私人留言的权限。

Most solutions seem to involve the user who is viewing the api-using page to forfill actions like "show me the posts of your wall!" 大多数解决方案似乎都涉及正在查看api使用页面的用户,以执行诸如“向我展示墙的帖子!”之类的操作。 or something. 或者其他的东西。 But of course that's not what I need. 但这当然不是我所需要的。 For my purpose the visitor does not even need to have a facebook account. 出于我的目的,访客甚至不需要拥有Facebook帐户。

[...] [...]

What I tried: 我试过的

  • I tried the api exlorer to understand how the stuff works. 我尝试了api审查程序来了解这些东西是如何工作的。 I mean. 我的意思是。 Even the api explorer is a app (written by facebook) which can easily get access to my private data 甚至api资源管理器都是一个应用程序(由Facebook编写),都可以轻松访问我的私人数据
  • I tried using api explorer generated key -> they expire 我尝试使用api资源管理器生成的密钥->它们过期
  • I tried using the offical PHP facebook api: 我尝试使用官方的PHP Facebook API:

    $facebook = new Facebook(array( 'appId' => 'myAppId', 'secret' => 'mySecret' )); $ facebook = new Facebook(array('appId'=>'myAppId','secret'=>'mySecret'));

    $foo = $facebook->api('/myprofileid/posts'); $ foo = $ facebook-> api('/ myprofileid / posts'); // -> only gets the public stuff //->仅获取公共内容

  • I tried using a "self made" app to access data of my profile 我尝试使用“自制”应用访问我的个人资料数据

All of these tries failed in non-understanding how that api and data stuff works and sticks together... 所有这些尝试都因无法理解api和数据的工作方式以及如何结合在一起而失败...

So the question is: How do I get the toke / the app to fetch private data from my profile? 因此,问题是:如何获取令牌/应用程序以从个人资料中获取私人数据? Or: What would be the right way to get this data? 或者:什么是获取此数据的正确方法?

Thanks ahead! 谢谢你!

You will need to extend the expiry of your access tokens to be able to do this and then store the long-term token in a database. 您将需要延长访问令牌的有效期限才能执行此操作,然后将长期令牌存储在数据库中。 Here are 2 pages(sections) that should help with this: 这里有2页(部分)应该可以帮助您:

https://developers.facebook.com/docs/facebook-login/access-tokens/#termtokens https://developers.facebook.com/docs/facebook-login/access-tokens/#termtokens

https://developers.facebook.com/docs/facebook-login/access-tokens/#extending https://developers.facebook.com/docs/facebook-login/access-tokens/#extending

Here is some info on extending the token: 以下是有关扩展令牌的一些信息:

GET /oauth/access_token?  
    grant_type=fb_exchange_token&           
    client_id={app-id}&
    client_secret={app-secret}&
    fb_exchange_token={short-lived-token} 

You will still want to extend your tokens periodically because they expire in ~60 days. 您仍需要定期扩展令牌,因为令牌会在约60天后过期。

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

相关问题 将照片发布到我的Facebook墙上(正在工作),但发布到用户供稿 - Posting a Photo to my Facebook Wall (working) But posts to the User Feed 隐藏除状态之外的Facebook页面墙贴 - Hide Facebook page wall posts apart from Statuses 无法检索Facebook Wall帖子 - Unable to retrieve Facebook Wall Posts 在PHP中使用facebook sdk 5从我的个人资料中获取最新的留言 - Getting the latest wall post from my profile using facebook sdk 5 in PHP 在页面墙上获取其他帖子(Facebook API) - Get posts by other on page wall (Facebook API) 需要帮助:从我的网站发布到Facebook页面墙 - Need Help: Publishing to Facebook page wall from my site http Graph不能从我的fb页面返回我的留言,但是使用fbFetch()和JSON可以正常工作 - http Graph is Not Returning my Wall Posts From my fb page, but with fbFetch() and JSON it works fine Facebook 和 php - 如何将内容从我的网站发布到我的 facebook 墙上? - Facebook and php - how to post content from my site to my facebook wall? 通过 PHP 检索我的 Facebook 粉丝页面墙贴现在会给出“请求此资源需要访问令牌”。 - Retrieving my Facebook fan page wall posts via PHP now gives “An access token is required to request this resource.” 如何使用Graph API资源管理器或FQL查看特定人员的所有墙上帖子? - How do I use Graph API explorer or FQL to see all my wall posts from a particular person?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM