2011-01-31 15 views
1

最新のつぶやきをウェブページに表示しようとしていますが、私はTwitterのAPIの新機能としてこれを行う方法がわかりませんが、ここまではこれまであります。Twitterの最新のつぶやきは動作しません

function my_streaming_callback($data, $length, $metrics) { 
    echo $data; 
} 

require '../tmhOAuth.php'; 
$tmhOAuth = new tmhOAuth(array(
    'consumer_key' => 'key', 
    'consumer_secret' => 'secret', 
    'user_token'  => 'token', 
    'user_secret'  => 'secret', 
)); 

$method = 'http://stream.twitter.com/1/statuses//show/:id.json'; 
//not sure where I am supposed to get the :id from? 

$params = array(
    //not sure what to put here, I would like to display the last 5 tweets 
); 

$tmhOAuth->streaming_request('POST', $method, $params, 'my_streaming_callback'); 
$tmhOAuth->pr($tmhOAuth); 

私が認証し、その後、TwitterのAPIとのインターフェイスにこのhttps://github.com/themattharris/tmhOAuthを使用していますが、これのすべては私にとって非常に新しいものであると私はそれが非常に混乱探しています。

基本的に私はちょうど最新のつぶやきを入手したいと思います。私はこれを早急にやっておく必要があるので、どんな助力も大いに感謝します! :)

答えて

1

ストリームAPIはに接続した後、のつぶやきだけを返します。 $idは、ユーザーのIDですhttp://dev.twitter.com/doc/get/statuses/show/:id

$tmhOAuth->request('GET', $tmhOAuth->url('1/statuses/show/$id')); 
$tmhOAuth->pr(json_decode($tmhOAuth->response['response'])); 

:以前のツイートを取得するには、一般的なREST APIメソッドを使用する必要があります。

+0

こちらをご覧ください。私は ':id'をどのように取得するのか不明です – Odyss3us

0

ご希望の場合はTHIS美しいjQueryプラグインを使用できます。それはあなたが必要とするものをいくつか行います。詳細については、http://tweet.seaofclouds.com/

関連する問題