Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/rest/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/reporting-services/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php twitter api 1.1状态/用户时间线_Php_Rest_Twitter - Fatal编程技术网

Php twitter api 1.1状态/用户时间线

Php twitter api 1.1状态/用户时间线,php,rest,twitter,Php,Rest,Twitter,早在2012年底,我就使用Abrhams twitteroauth和OAuth.php编写了我的1.1原始代码,代码使用的是/1/endpoint。它工作得很好,因为我可以连接,获得授权,获得长期令牌,获得更新和tweet。。。没问题 当1.0被太阳遮住时,它的功能中断了(duh!),花了很长时间才回到我的办公桌上。我做的第一件事是将api从/1/更改为/1.1/,我们主要是在工作。。。我说的主要是。。。存在一些问题: 问题1: 我正在授权、获取令牌等。我可以登录到测试帐户(@test1)并手动

早在2012年底,我就使用Abrhams twitteroauth和OAuth.php编写了我的1.1原始代码,代码使用的是/1/endpoint。它工作得很好,因为我可以连接,获得授权,获得长期令牌,获得更新和tweet。。。没问题

当1.0被太阳遮住时,它的功能中断了(duh!),花了很长时间才回到我的办公桌上。我做的第一件事是将api从/1/更改为/1.1/,我们主要是在工作。。。我说的主要是。。。存在一些问题:

问题1: 我正在授权、获取令牌等。我可以登录到测试帐户(@test1)并手动发送tweet,该tweet通过状态/更新获取,并根据我们的需要进行处理。如果该tweet指向特定用户(@test2),那么test2上的status/update不会检测到传入的tweet,尽管它在twitter@选项卡上被视为“交互”

问题2: 当我试着代表一个用户发tweet/reply(几乎我所有的tweet都是在_reply _to)时,帖子永远不会返回,但显然tweet会被发送(这可能是twitteroauth.php的问题)


关于如何修复这些东西,有什么建议吗?

#1:什么是
包含实体
,我不知道API中是否有。。。你需要使用
状态/提及时间线
来查看提及#2:我不理解你的问题。包括实体在api中,它会扩展发送的数据以包括更多不神秘的信息。。。我认为违约是真的。提到时间线。。。刚找到那个。。。不知道为什么它没有在/1/api上进行特定的单独调用而不是在/1.1/-现在每个用户都需要两个调用。。。废话!仍然存在发布问题。好吧,我现在看到了,但在1.1中它总是设置为true。你是对的。。。好的,把那个拿出来!
$twitter = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, 
                            $access_token['oauth_token'], $access_token['oauth_token_secret']);

$params = array('screen_name' => $tw_name,
                  'include_entities' => "TRUE",
                  'since_id ' => $tw_last);

$results = $twitter->get('statuses/user_timeline', $params); 
$twitter = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, 
                            $access_token['oauth_token'], $access_token['oauth_token_secret']);

$user = $twitter->get('account/verify_credentials');

// build a tweetback @address
// might be our own address but lets see... 
$message = "@" .$tweetback['tw_src'] ." $message";

// tweet the reply      
$tweet = array('status' => $message, 'in_reply_to_status_id' =>$tweetback['tw_topicid']);

// post the tweet
$response = $twitter->post('statuses/update', $tweet);