阅读twitter api用法的简单方法

可能像很多人一样,我的网站受到了Twitter弃用基本身份验证的影响,所以我一直在考虑实施OAuth。 但我想做的只是从我的帐户中提取最后几条推文 - 我不需要发布任何内容,它只是只读访问用户时间线。 我已经看过几篇帖子展示了如何使用javascript轻松完成这项工作,所以我认为PHP也可能同样简单(即不需要OAuth)? 必须使用PHP而不是Javascript的一个原因是我需要检查何时将超过速率限制,然后我将最后几条推文缓存所需的时间。 </ p>

如果OAuth是最好的解决方案,我会继续这样做 - 感谢任何建议!</ p>
</ div>

展开原文

原文

probably like many people my site has been affected by twitter deprecating basic authentication, so I was looking at implementing OAuth. But all I want to do is just pull the last couple of tweets from my account - I don't need to post anything, it's just readonly access to the user timeline. I've seen a couple of posts showing how to do this easily with javascript, so i'm thinking it might also be similarly straightforward with PHP (i.e not requiring OAuth)? One reason for having to use PHP instead of Javascript is that i need to check when the rate limit is about to be exceeded, then I cache the last couple of tweets for the required amount of time.

If OAuth is the best solution, I'll get on with that - grateful for any suggestions though!

doubeng9407
doubeng9407 我认为使用phpcurl,你可以轻松获得推文帐户的最新帖子。看到这个链接veerasundar.com/blog/2009/06/...
大约 10 年之前 回复

1个回答



我写了一篇文章,展示了如何做到这一点:</ p>

http://philsturgeon.co.uk / news / 2009/07 /如何创建一个Twitter-feed-with-full-syntax-support </ p>

但基础知识更加简单。 这一切归结为:</ p>

  $ tweets = json_decode(
file_get_contents('http://twitter.com/statuses/user_timeline/philsturgeon.json?count=10' )
);
</ code> </ pre>

享受。</ p>
</ div>

展开原文

原文

I wrote a article showing how to do this:

http://philsturgeon.co.uk/news/2009/07/How-to-Create-a-Twitter-feed-with-full-syntax-support

but the basics are even easier. It all boils down to:

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

Enjoy.

douliaodan2738
douliaodan2738 找不到404文件
接近 4 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐