function twitter_post in Twitter 5
Implements the twitter posting API per: http://twitter.com/help/api
1 call to twitter_post()
File
- ./
twitter.module, line 51
Code
function twitter_post($node, $account) {
if (empty($account->twitter_encrypted)) {
return false;
}
$text = $account->twitter_text ? $account->twitter_text : 'New post: !title (!url)';
$text = t($text, array(
'!title' => $node->title,
'!url' => url('node/' . $node->nid, NULL, NULL, TRUE),
));
$headers = array(
'Authorization' => 'Basic ' . $account->twitter_encrypted,
'Content-type' => 'application/x-www-form-urlencoded',
);
$data = 'status=' . urlencode($text);
$result = drupal_http_request(TWITTER_URL, $headers, 'POST', $data);
drupal_set_message(t('Posted to twitter.com'));
}