Facebook API / httpclient包装器,用于爬过墙上的帖子&任何用户的群组帖子? [英] Facebook API / httpclient wrapper for crawling through the wall posts & group posts of any user?

查看:134
本文介绍了Facebook API / httpclient包装器,用于爬过墙上的帖子&任何用户的群组帖子?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个全新的facebook api,并在一个非常小的项目上工作。在了解他们的api文档的详细信息之前,我想问一个快速的问题。

I am completely new to facebook api and working on a very small project. Before getting into details of their api doc, I wanted to ask a quick question.

我的应用程序需要使用Facebook用户名/密码登录,去朋友墙/组墙壁,爬过所有墙壁柱子,并将其转储在数据库中进行进一步分析。一个简单的http客户端会做的伎俩如果没有javascript完全不可用的Facebook。由于它是一个桌面应用程序,我不愿意去完整的基于服务器的应用程序。

My application needs login with a facebook userid/password, go to a friends wall / groups wall, crawl through all the wall posts and dump them in database for further analysis. A simple http client would do the trick if facebook weren't completely unusable without javascript. Since its going to be a desktop app, I am reluctant to go for a full fledged server based app.

那么最简单的方法是通过FB朋友/组墙来爬行呢?如果我提出错误的问题,请更正我,因为我有零FB知识。

So what should be the simplest way of crawling through FB friend / group wall? Please correct me if I'm asking the wrong question because I have Zero FB knowledge.

PS:我想要一个基于java的库/包装器,但是任何语言都可以。

PS: I would like a java based library / wrapper but any language would do...

推荐答案

先决条件:

您的群组需要公开可见您需要注册才能制作一个Facebook应用程序,以获得APP_ID AND SECRET_KEY。

Your group needs to be publicly viewable You need to have signed up to make a Facebook app, in order to get the APP_ID AND SECRET_KEY.

然后,(PHP中的示例,但应该很容易被转置为另一种语言):

Then, (example in PHP, but should easily be transposed to another language):

$url =
"https://graph.facebook.com/{$group_id}/feed?access_token=APP_ID|SECRET_KEY";

$data = json_decode(file_get_contents($url));

foreach($data->data as $d)
{
   ?>
   <div>
    <a href="http://facebook.com/profile.php?id=<?=$d->from->id?>">
    <img border="0" alt="<?=$d->from->name?>"
        src="https://graph.facebook.com/<?=$d->from->id?>/picture"/>
    </a>
   </div>
   <div>
    <a href="http://facebook.com/profile.php?id=<?=$d->from->id?>">
    <?=$d->from->name?></a>
    on <?=date('F j, Y H:i',strtotime($d->created_time))?>
    <br/>
    <?=$d->message?>
  </div>
</div>
<?
}

这将得到墙上的帖子。就限制而言,我不知道。

This will get the wall posts. As far as limits, I don't know.

这篇关于Facebook API / httpclient包装器,用于爬过墙上的帖子&amp;任何用户的群组帖子?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆