2011-02-07 57 views
1

嘿家伙, 环顾四周,但无法完全得到答案或自己想象。基本上,试图让“in_reply_to_status_id”值statuses/user_timeline和PHP($ replycheck)将其设置为可变的,继承人什么我已经写了,但无济于事从状态/ user_timeline Twitter中获取“in_reply_to_status_id”API PHP

<?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

如果状态不是回复其他内容? – Arvin 2011-02-07 17:13:02

+0

它只是返回空 – DexCurl 2011-02-07 17:14:08

回答

2

查看http://api.twitter.com/1/statuses/user_timeline.json?screen_name=jwhelton在您的浏览器中查看。

改为使用:in_reply_to_status_id_str。 PHP的ID号太高,无法评估,所以它变成了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; 
}