You are here

function twitter_fetch_followers in Twitter 6.2

Fetch information about users following a given Twitter.com account.

This function is mostly useful for mining information about connections, and locating existing Twitter friends who have also signed up for the same Drupal site.

Parameters

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

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

Return value

An array of Twitter accounts.

See also

twitter_fetch_friends()

File

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

Code

function twitter_fetch_followers($screen_name, $password) {
  $url = "http://" . variable_get('twitter_api_url', 'twitter.com') . "/statuses/followers/{$screen_name}.xml";
  $headers = array(
    'Authorization' => 'Basic ' . base64_encode($screen_name . ':' . $password),
    'Content-type' => 'application/x-www-form-urlencoded',
  );
  $results = drupal_http_request($url, $headers, 'GET');
  if (_twitter_request_failure($results)) {
    return array();
  }
  return _twitter_convert_xml_to_array($results->data);
}