使用PHP抓取推文

时间:2012-04-08 11:22:42

标签: php twitter web-crawler

我正试图从Twitter上抓取推文。我有一个用户列表,我想从他们的推文中获取并将它们存储在我的数据库中。我想知道我是否要使用Twitter API,或者我是否有任何简单的代码来实现这一目标。

根据https://dev.twitter.com/docs/twitter-libraries#php,PHP中有五个库。我想知道哪一个对我有用?

谢谢大家。

1 个答案:

答案 0 :(得分:3)

借助Twitter,它变得更加简单。只需file_get_contents()此网址:http://twitter.com/statuses/user_timeline.json?screen_name=USERNAME&count=10,您将获得带有USERNAME的10条最新推文的JSON。

$tweets = json_decode(file_get_contents('http://twitter.com/statuses/user_timeline.json?screen_name=USERNAME&count=10'));

var_dump($tweets);
相关问题