我正在使用twitter api来获取最新的提及。
Twitter api链接:https://dev.twitter.com/rest/reference/get/statuses/mentions_timeline
用于上次提及的功能:
function twitter_get_tweets(){
$connection = $this->twitter_auth();
$latest_tweet = $connection->get('statuses/mentions_timeline', array('count' => 1));
return $latest_tweet;
}
回复预览:http://projects.helpful.ninja/twitter/
遗憾的是我无法直接访问那里的变量,例如文本节点。
示例:
[text] => @pr0b_ Submit a request to our Support team and they'll be in touch ASAP
正在测试类似的内容:
$twitter_bot = new twitter_bot_functions($twitter_settings['api_key'], $twitter_settings['api_secret'], $twitter_settings['access_token'], $twitter_settings['access_token_secret']);
$get_latest_mention = $twitter_bot->twitter_get_tweets();
echo $get_latest_mention['text'];
有人知道我做错了吗?
答案 0 :(得分:0)
首先是数组,然后是stdClass对象。所以你应该像
一样使用它 echo $get_latest_mention[0]->text;