php - 使用 PHP 抓取推文

标签 php twitter web-crawler

<分区>

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

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

谢谢大家

最佳答案

有了 Twitter,再简单不过了。只需 file_get_contents() 这个 URL: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);

关于php - 使用 PHP 抓取推文,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10062429/

相关文章:

php - MYSQLI::prepare() ,使用占位符时出错:something

php - Amazon 通过 API 将文件从 S3 移动到 Glacier

iphone - 在 Twitter iOS5 iPhone 中保留用户名

python - 使用 beautifulsoup 在 ID 或类名称中查找特定单词

c# - 使用未知大小队列的网络爬虫的生产者/消费者

python - (Python, Selenium) 是否只有属性满足条件才能获取文本列表?

php - 如何包装PDO类?

php - 使用 Zend_Db_Table_Abstract 限制查询返回列

php - Twitter 请求 - 正确的方式

python - 如何在python中使用tweepy访问带有不记名 token 的推文?