function twitter_fetch_account_info in Twitter 6.2
Fetch the full information for a Twitter.com account.
This function requires an authenticated connection for the account in question.
Parameters
$screen_name: The screen name of a Twitter.com user.
$password: The password of a Twitter.com user.
$cache: A boolean indicating whether the account info should be cached in the local site's database after it's retrieved.
Return value
An single Twitter account.
2 calls to twitter_fetch_account_info()
File
- ./
twitter.inc, line 187 - A wrapper API for the Twitter microblogging service.
Code
function twitter_fetch_account_info($screen_name, $password, $cache = TRUE) {
$url = "http://" . variable_get('twitter_api_url', 'twitter.com') . "/users/show/{$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();
}
if ($results = _twitter_convert_xml_to_array($results->data)) {
if ($cache) {
foreach ($results as $user) {
twitter_cache_account($user);
}
}
return $results[0];
}
return array();
}