1

ウェブページに最新のツイートを表示しようとしていますが、Twitter API に非常に慣れていないため、その方法がわかりませんが、これまでのところ.

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);

私はこのhttps://github.com/themattharris/tmhOAuthを使用して認証し、Twitter API とやり取りしていますが、これらすべてが私にとって非常に新しいため、非常に混乱しています。

だから基本的には最新のつぶやきを試してみたいと思います。できるだけ早くこれを完了する必要があるので、どんな助けも大歓迎です。事前に感謝します! :)

4

2 に答える 2

1

Stream API は、接続後に投稿されたツイートのみを返します。以前のツイートを取得するには、一般的な REST API メソッドを使用する必要があります: 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']));

$idユーザーのIDはどこにありますか。

于 2011-01-31T06:42:41.237 に答える
0

必要に応じて、この美しい jQuery プラグインを使用できます。必要に応じていくつかのことを行います。詳細については、http://tweet.seaofclouds.com/をご覧ください。

于 2011-01-31T07:37:13.113 に答える