I am following the response to one of my previous posts ( Show an RSS feed item on the intranet via php ) and trying to train.
Now I retrieve the data, but how to get a "full post / story", it seems to me that I can get a title and description:
<?php
$a = curl_init("http://newsrss.bbc.co.uk/rss/on_this_day/front_page/rss.xml");
curl_setopt($a, CURLOPT_RETURNTRANSFER,1);
$b = curl_exec($a);
$xml = simplexml_load_string($b);
print "<pre>";
print_r($xml);
print "</pre>";
?>
And this is my conclusion:
SimpleXMLElement Object
(
[@attributes] => Array
(
[version] => 2.0
)
[channel] => SimpleXMLElement Object
(
[title] => BBC On This Day | Front Page
[link] => http:
[description] => SimpleXMLElement Object
(
)
[language] => en-gb
[lastBuildDate] => Mon, 25 Oct 2010 00:15:09 GMT
[copyright] => Copyright: (C) British Broadcasting Corporation, http:
[docs] => http:
[ttl] => 15
[image] => SimpleXMLElement Object
(
[title] => BBC On This Day
[url] => http:
[link] => http:
)
[item] => Array
(
[0] => SimpleXMLElement Object
(
[title] => 1983: US troops invade Grenada
[description] => American forces seize control of the Caribbean island of Grenada less than a week after a left-wing coup in which the prime minister, Maurice Bishop, was killed.
[link] => http:
[guid] => http:
[pubDate] => Fri, 24 Oct 2003 08:35:04 GMT
[category] => 25
)
[1] => SimpleXMLElement Object
(
[title] => 1964: President Kaunda takes power in Zambia
[description] => Zambia is the ninth African state to gain independence from the British crown.
[link] => http:
[guid] => http:
[pubDate] => Thu, 06 Feb 2003 16:40:25 GMT
[category] => 25
)
[2] => SimpleXMLElement Object
(
[title] => 1984: Europe grants emergency aid for Ethiopia
[description] => The EEC is donating £1.8 million to help combat the famine in Ethiopia.
[link] => http:
[guid] => http:
[pubDate] => Thu, 14 Nov 2002 17:55:28 GMT
[category] => 25
)
[3] => SimpleXMLElement Object
(
[title] => 1976: Queen opens National Theatre in London
[description] => The Queen has officially opened the National Theatre on the South Bank in London after years of delays.
[link] => http:
[guid] => http:
[pubDate] => Thu, 14 Nov 2002 17:45:57 GMT
[category] => 25
)
[4] => SimpleXMLElement Object
(
[title] => 2001: Crime rates lowest for 20 years
[description] => British Crime Survey reveals the chances of being a victim of crime are lowest for 20 years.
[link] => http:
[guid] => http:
[pubDate] => Thu, 14 Nov 2002 17:42:23 GMT
[category] => 25
)
)
)
)
source
share