I do this and it works.
<?php
function load_file($url)
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$xml = simplexml_load_string(curl_exec($ch));
return $xml;
}
$feedurl = 'http://www.astrology.com/horoscopes/daily-extended.rss';
$rss = load_file($feedurl);
$items = array();
$count = 0;
foreach ($rss->channel->item->description as $i => $description)
{
$items[$count++] = $description;
}
echo $items[0];
?>
When I echo $items[1]; it doesn’t show the next one in line. Not sure what I did wrong.
Here is an example of your xml:
When you do
$rss->channel->item->descriptionyou’re getting the firstitem‘sdescription.You need to first loop through the
itemsand then get each description.e.g.:
Hope that helps. Its untested, but should work.