[英]user stream in twitter api
I want to read my own twit in a litte localhost application in js + php. 我想在js + php的本地主机应用程序中读取自己的twit。
I know how to read the json in api.twitter.com/1/statuses/user_timeline.json?screen_name=myName but due to the limit rate I need to make a User Stream ( https://dev.twitter.com/docs/streaming-api/user-streams ) 我知道如何在api.twitter.com/1/statuses/user_timeline.json?screen_name=myName中读取json,但是由于限制速率,我需要创建一个用户流( https://dev.twitter.com/docs / streaming-api / user-streams )
I have my 4 keys by create a dev account : 我通过创建开发人员帐户拥有4个密钥:
'consumer_key' => '*****',
'consumer_secret' => '*****',
'user_token' => '*******',
'user_secret' => '******',
So I try with this https://github.com/themattharris/tmhOAuth/blob/master/examples/userstream.php 所以我尝试使用这个https://github.com/themattharris/tmhOAuth/blob/master/examples/userstream.php
Why this hapeens? 为什么会这样?
Streaming API is not right tool for litte application You are better off with plain REST API. Streaming API不是适用于小型应用程序的工具,使用普通的REST API更好。
Streaming API application is not supposed to be run in browser; 流API应用程序不应在浏览器中运行; don't forget to
set_time_limit(0)
and start your .php script in comandline - where it will run forever (you should save tweets in database so your normal browser scripts could display them) 不要忘了
set_time_limit(0)
并以comandline启动.php脚本-它将在其中永久运行(您应该将tweet保存在数据库中,以便普通的浏览器脚本可以显示它们)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.