<?php
$consumerKey = 'x';
$consumerSecret = 'x';
$oAuthToken = 'x';
$oAuthSecret = 'x';
// Create Twitter API objsect and fake a user agent to have higher rate limit
require_once("twitteroauth.php");
$oauth = new TwitterOAuth($consumerKey, $consumerSecret, $oAuthToken, $oAuthSecret);
$oauth->useragent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071025 Firefox/2.0.0.9';
$reply_result = $oauth->get('http://api.twitter.com/1/statuses/user_timeline.json?screen_name=jwhelton');
$tweetid = $reply_result ->id;
$checkreply = $reply_result ->in_reply_to_status_id;
echo "<br /><br />Last tweet was id'd as ".$tweetid." and was reply of ".$checkreply;
?>
感谢任何能够帮助我的人!
答案 0 :(得分:2)
请在浏览器上查看http://api.twitter.com/1/statuses/user_timeline.json?screen_name=jwhelton以查看。
使用:in_reply_to_status_id_str
代替。身份证号码太高,PHP无法评估,因此它变为null
。所以代码可以是:
$reply_result = $oauth->get('http://api.twitter.com/1/statuses/user_timeline.json?screen_name=jwhelton');
foreach($reply_result as $i => $tweet) {
$tweetid = $tweet->id_str;
$checkreply = $tweet->in_reply_to_status_id_str;
echo "<br /><br />Last tweet was id'd as ".$tweetid." and was reply of ".$checkreply;
}