2013-06-25 49 views
0

我用下面的代碼,試圖從我home_timelinehome_timeline失蹤鳴叫 - API 1.1

$tmhOAuth = new tmhOAuth(array('consumer_key' => TW_KEY, 
        'consumer_secret' => TW_SECRET, 
         'user_token'  => TW_UTOKEN, 
         'user_secret'  => TW_USECRET, 
         )); 
    $code = $tmhOAuth->request('GET', $tmhOAuth->url('1.1/statuses/home_timeline', 'json')); 

的$ tmhOAuth從這個庫這裏走來搶鳴叫:https://github.com/themattharris/tmhOAuth

出於某種原因,只有一個鳴叫正在顯示,這是我最近的一個。我所有的舊推文都不可見。當我將祕密和密鑰更改爲另一個用戶應用的密鑰和密鑰時,我有類似的問題,有些推文是可見的,而另一些則不是。有誰知道爲什麼它不會只抓取所有X次的最新推文?爲什麼缺少一些推文?

+1

繼你[前一個問題(http://stackoverflow.com/questions/17097357/twitter-search-by-hashtag-example-api -v-1-1),你甚至試過我建議的圖書館嗎?嘗試替代庫,然後,如果你仍然從API獲得相同的結果,那麼你知道這是Twitter的一個問題。 – Jimbo

回答

0

我下載Jimbo's API from github後再也興田以下代碼

<?php 
ini_set('display_errors', 1); 
require_once('twjimbo/TwitterAPIExchange.php'); 

/** Set access tokens here - see: https://dev.twitter.com/apps/ **/ 
$settings = array(
    'oauth_access_token' => "", 
    'oauth_access_token_secret' => "", 
    'consumer_key' => '', 
    'consumer_secret' => "" 
); 

] 
$url = 'https://api.twitter.com/1.1/statuses/home_timeline.json'; 
$getfield = '?screen_name=anythingworkshere'; 
$requestMethod = 'GET'; 
$twitter = new TwitterAPIExchange($settings); 
$json = $twitter->setGetfield($getfield) 
      ->buildOauth($url, $requestMethod) 
      ->performRequest(); 

echo '<pre>'; print_r(json_decode($json)); echo '</pre>';