使用TwitterOauth直接消息

时间:2011-09-06 10:19:00

标签: twitter-oauth

我正在使用以下方法,但它无效。

$twitteroauth->post('direct_messages/new', array(
    'text' => 'dm text here',
    'screen_name' => 'recipients screen_name',
));

1 个答案:

答案 0 :(得分:0)

$twitter = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, 
                            $access_token['oauth_token'], $access_token['oauth_token_secret']);

// $message must have the @name of the user who created the message 
// referenced in the 'in_reply_to_status_id' field
$tweet = array('status' => $message,
               'in_reply_to_status_id' =>$tweetback['tw_topicid']); 

// post the tweet
$response = $twitter->post('statuses/update', $tweet);