Return items in rss as name value pairs

Return items in rss as name value pairs

Posted by: therookie
Posted on: 2007-06-15 11:57:00

I was trying to follow the tut at this site: http://www.adobe.com/devnet/devices/articles/flashlite11_rss.html

But the method he is using to load the rss info is not allowed by dreamhost. I have tried changed the code a bit using CURL but dont think i am doing it right as I am not a php guy... The print statements there are for debugging but arent doing anything. (printing anything)
<?php
//Link to RSS 2.0 feed
$http = "http://my.abcnews.go.com/rsspublic/fp_rss20.xml";

$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, "http://my.abcnews.go.com/rsspublic/fp_rss20.xml");
curl_setopt($ch,CURLOPT_HEADER,0);
curl_exec($ch);

//Counter to append to &variables to return to the client
$i=1;
// This PHP 5 function loads the entire XML feed
//$xml = simplexml_load_file($http);
$xml = curl_exec($ch);

// Parse each item in the RSS feed
foreach ($xml->channel[0]->item as $item)
{
if($item) {
// Need to strip html tags since Flash Lite does not support
// html in dynamic text fields
$title = strip_tags($item->title);
$description = strip_tags($item->description);
// Replace special symbols &
$title = str_replace("&", "", $title);
$description = str_replace("&", "", $description);
// Return the content with the appropriate index
echo "&title$i=".$title;
echo "&description$i=".$description;
print"title = $title";
print"description = $description";
print"item = $item";
//echo $i;
$i++;
} else {
// Send and Error message if content is not found
echo "&msg=Content not found";
echo "&flag=error";
echo "&end=end";
exit;
}
}
$i=$i-1;
echo "&flag=ok";
echo "&totalitems=".$i;
echo "&end=end";
curl_close($ch);
?>

Tags: dreamhostarentdebuggingadobe