You are here

function twitter_authenticate in Twitter 6.2

Attempts to authenticate a username/password on Twitter.com.

Parameters

$screen_name: The screen name of a Twitter.com user.

$password: The password of a Twitter.com user.

Return value

A boolean indicating success or failure.

2 calls to twitter_authenticate()
twitter_actions_set_status_action_validate in twitter_actions/twitter_actions.module
twitter_add_account_validate in ./twitter.pages.inc

File

./twitter.inc, line 306
A wrapper API for the Twitter microblogging service.

Code

function twitter_authenticate($screen_name, $password) {
  $url = "http://" . variable_get('twitter_api_url', 'twitter.com') . "/account/verify_credentials.xml";
  $headers = array(
    'Authorization' => 'Basic ' . base64_encode($screen_name . ':' . $password),
    'Content-type' => 'application/x-www-form-urlencoded',
  );
  $results = drupal_http_request($url, $headers, 'GET');
  drupal_http_request('http://' . variable_get('twitter_api_url', 'twitter.com') . '/account/end_session', $headers, 'GET');
  return $results->code == '200';
}