使用twitteroauth获取tweetID

时间:2013-08-24 20:42:21

标签: php twitter

我正在使用亚伯拉罕的代码连接到高音扬声器并发送我自己的推文,直到现在这么好。 我的问题是,当我发布我的新推文时,我需要tweetID,但我无法弄清楚如何获得它?

我使用此代码:     

$tweet = new TwitterOAuth($consumerKey, $consumerSecret, $oAuthToken, $oAuthSecret);

// Post the status message
$tweetMessage="Welcome to my mundo !!";
$tweet->post('statuses/update', array('status' => $tweetMessage));

var_dump($tweet);
echo $tweet->http_code ; //$tweet->status";

?>

当我进行转储时,我找不到id_str,有人告诉我这是唯一的ID吗?

我怎么能从这段代码获得tweetID?

TIA

1 个答案:

答案 0 :(得分:0)

如果您的推文成功发布到Twitter,您将在使用时获得json数据值

var_dump($tweet);
echo $tweet->id_str;

$ tweet-> id_str只会根据需要为您提供推文ID。