2011-02-07 82 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; 
} 
相關問題