function messaging_twitter_send_dm in Messaging 6.4
Same name and namespace in other branches
- 6 messaging_twitter/messaging_twitter.module \messaging_twitter_send_dm()
- 6.2 messaging_twitter/messaging_twitter.module \messaging_twitter_send_dm()
- 6.3 messaging_twitter/messaging_twitter.module \messaging_twitter_send_dm()
Send a direct message to Twitter user
1 string reference to 'messaging_twitter_send_dm'
- messaging_twitter_messaging in messaging_twitter/
messaging_twitter.module - Implementation of hook_messaging
File
- messaging_twitter/
messaging_twitter.module, line 78 - Messaging Twitter sending method
Code
function messaging_twitter_send_dm($destination, $message, $params = array()) {
_messaging_twitter_include();
$url = 'http://twitter.com/direct_messages/new.xml';
$site_username = variable_get('messaging_twitter_username', '');
$site_password = variable_get('messaging_twitter_password', '');
$headers = array(
'Authorization' => 'Basic ' . base64_encode($site_username . ':' . $site_password),
'Content-type' => 'application/x-www-form-urlencoded',
);
$data = 'text=' . urlencode($message
->get_text()) . '&user=' . $destination;
$result = drupal_http_request($url, $headers, 'POST', $data);
return $result && $result->code == 200;
}