PHP has an XML Parser that I found worked well. http://php.net/manual/en/book.xml.php
Here's how I wrote one for Twitter (using the code examples on the PHP site):
function startElement($parser, $name, $attrs)
{
}
function endElement($parser, $name)
{
}
function twitter_retrieve()
{
$curl = curl_init("http://twitter.com/statuses/user_timeline/xxxxxxxx.rss");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/atom+xml'));
$response = curl_exec($curl);
if (!$response) {
return array(0 => array('body' => 'Twitter site fault: no data to read.',
'date' => date("jS F Y", mktime()),
'link' => ''));
}
curl_close($curl);
$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_parse_into_struct($xml_parser, $response, $vals, $index);
// Next line will show you what you're getting back which is very useful.
// the LEVEL aspect is important for navigating.
// print_r($vals);
$output = array();
$j = 0;
for($i=0; $i<count($vals); $i++)
{
if($vals[$i]['level'] == 4)
{
if($vals[$i]['tag'] == 'DESCRIPTION')
{
$output[$j]['body'] = isset($vals[$i]['value']) ? substr($vals[$i]['value'],16) : ''; // 16 is the length of this person's Twitter username to get rid of their username fronting each tweet.
}
if($vals[$i]['tag'] == 'PUBDATE')
$output[$j]['date'] = substr($vals[$i]['value'], 0, -6);
if($vals[$i]['tag'] == 'LINK')
{
$pos = strrpos($vals[$i]['value'], '/');
$output[$j++]['uid'] = substr($vals[$i]['value'], ($pos+1));
}
}
}
xml_parser_free($xml_parser);
return $output;
}