function _twitter_convert_xml_to_array in Twitter 6.2
Internal XML munging code
5 calls to _twitter_convert_xml_to_array()
- twitter_fetch_account_info in ./
twitter.inc - Fetch the full information for a Twitter.com account.
- twitter_fetch_followers in ./
twitter.inc - Fetch information about users following a given Twitter.com account.
- twitter_fetch_friends in ./
twitter.inc - Fetch information about Twitter.com accounts followed by a given user.
- twitter_fetch_statuses in ./
twitter.inc - Fetch the latest statuses for a Twitter.com account, regardless of privacy.
- twitter_fetch_timeline in ./
twitter.inc - Fetch the public timeline for a Twitter.com account.
File
- ./
twitter.inc, line 482 - A wrapper API for the Twitter microblogging service.
Code
function _twitter_convert_xml_to_array($data) {
$results = array();
try {
$xml = new SimpleXMLElement($data);
} catch (Exception $e) {
watchdog('twitter', t('Convering XML to array failed. One possible reason is that ' . 'Twitter is down now. The convert failed with the following error: !exception.'), array(
'!exception' => $e,
));
return $results;
}
if (!empty($xml->name)) {
// Top-level user information.
$results[] = _twitter_convert_user($xml);
return $results;
}
if (!empty($xml->user)) {
foreach ($xml->user as $user) {
$results[] = _twitter_convert_user($user);
}
}
elseif (!empty($xml->status)) {
foreach ($xml->status as $status) {
$results[] = _twitter_convert_status($status);
}
}
return $results;
}