function twitter_fetch_statuses in Twitter 6.2
Fetch the latest statuses for a Twitter.com account, regardless of privacy.
This function is the authenticated version of twitter_fetch_timeline(), and is the only way to retrieve statuses for a 'private' account.
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 statuses should be cached in the local site's database after they're retrieved.
Return value
An array of Twitter statuses.
See also
2 calls to twitter_fetch_statuses()
- twitter_cron in ./
twitter.module - Implementation of hook_cron()
- twitter_user_save in ./
twitter.inc
File
- ./
twitter.inc, line 226 - A wrapper API for the Twitter microblogging service.
Code
function twitter_fetch_statuses($screen_name, $password, $cache = TRUE) {
$url = "http://" . variable_get('twitter_api_url', 'twitter.com') . "/statuses/user_timeline.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();
}
$results = _twitter_convert_xml_to_array($results->data);
if ($cache && !empty($results)) {
foreach ($results as $status) {
twitter_cache_status($status);
}
twitter_touch_account($screen_name);
}
return $results;
}