dinsdag 22 mei 2012
Show Multiple RSS Feeds
Items in the RSS Feed
Display a linked title to each item in the RSS feed
Behind the scenes, this is fetching the RSS feed over HTTP, parsing it, and then creating a list of linked items.
Nato Chicago protests hit Boeing
From: http://newsrss.bbc.co.uk/rss/newsonline_world_edition/americas/rss.xml
Protesters in Chicago rally at the HQ of defence giant Boeing, one day after violent clashes and arrests as Nato leaders hold a summit in the city.
Published: May 21, 2012 23:05:49
Nato endorses Afghan timetable
From: http://newsrss.bbc.co.uk/rss/newsonline_world_edition/front_page/rss.xml
Nato leaders endorse plans to hand combat command in Afghanistan to local forces by mid-2013 and withdraw fighting troops by 2014.
Published: May 21, 2012 23:05:21
Jail for US webcam spy student
From: http://newsrss.bbc.co.uk/rss/newsonline_world_edition/americas/rss.xml
A US student who used a webcam to secretly film his room-mate in a gay encounter is sentenced to 30 days in prison by a judge.
Published: May 21, 2012 22:05:23
Protesters attack Mali president
From: http://newsrss.bbc.co.uk/rss/newsonline_world_edition/africa/rss.xml
Interim Mali President Dioncounda Traore is briefly hospitalised with a head wound after being attacked in his office by demonstrators, officials say.
Published: May 21, 2012 22:05:46
Facebook closes below float price
From: http://newsrss.bbc.co.uk/rss/newsonline_world_edition/americas/rss.xml
Shares in Facebook slump as much as 12%, falling below the initial price they were launched at on Friday in one of the world's biggest flotations.
Published: May 21, 2012 22:05:11
SpaceX to attempt second lift-off
From: http://newsrss.bbc.co.uk/rss/newsonline_world_edition/americas/rss.xml
The US firm SpaceX will try again on Tuesday to launch its re-supply mission to the space station.
Published: May 21, 2012 22:05:52
'Lake red' after Breivik killings
From: http://newsrss.bbc.co.uk/rss/newsonline_world_edition/front_page/rss.xml
A man who survived Anders Behring Breivik's attack on Utoeya island tells his trial the surrounding lake was red with blood following the massacre.
Published: May 21, 2012 21:05:05
Stars pay tribute to Robin Gibb
From: http://newsrss.bbc.co.uk/rss/newsonline_world_edition/front_page/rss.xml
Sir Cliff Richard, Ringo Starr and Dionne Warwick lead the tributes to Bee Gee Robin Gibb, who has died aged 62.
Published: May 21, 2012 19:05:28
Suicide attack targets Yemen army
From: http://newsrss.bbc.co.uk/rss/newsonline_world_edition/front_page/rss.xml
More than 90 people have been killed in a suicide bomb attack claimed by al-Qaeda on soldiers in the Yemeni capital, Sanaa, security officials say.
Published: May 21, 2012 18:05:41
Dutch pre-school abuser is jailed
From: http://newsrss.bbc.co.uk/rss/newsonline_world_edition/front_page/rss.xml
A Latvian-born Dutch man is sentenced to 18 years in prison for abusing more than 60 children, some just a few months old, in a case that has shocked the Netherlands.
Published: May 21, 2012 18:05:39
Ex-Gaddafi spy chief 'charged'
From: http://newsrss.bbc.co.uk/rss/newsonline_world_edition/africa/rss.xml
Muammar Gaddafi's ex-spy chief Abdallah al-Senussi - wanted by Libya and the ICC - is charged with illegal entry into Mauritania, officials say.
Published: May 21, 2012 17:05:09
Lockerbie bomber's funeral held
From: http://newsrss.bbc.co.uk/rss/newsonline_world_edition/africa/rss.xml
Lockerbie bomber Abdelbaset al-Megrahi has been buried in a private ceremony in the Libyan capital, Tripoli.
Published: May 21, 2012 15:05:32
UN human rights head in Zimbabwe
From: http://newsrss.bbc.co.uk/rss/newsonline_world_edition/africa/rss.xml
UN human rights chief Navi Pillay has started a week-long visit to Zimbabwe, during which she is expected to meet President Robert Mugabe.
Published: May 21, 2012 14:05:11
Three climbers die on Mt Everest
From: http://newsrss.bbc.co.uk/rss/newsonline_world_edition/americas/rss.xml
Climbers from Canada, Germany and South Korea have died as they returned from the summit of Mount Everest, officials in Nepal say.
Published: May 21, 2012 12:05:04
The Code:
<?php
$urls = array("http://newsrss.bbc.co.uk/rss/newsonline_world_edition/front_page/rss.xml",
"http://newsrss.bbc.co.uk/rss/newsonline_world_edition/africa/rss.xml",
"http://newsrss.bbc.co.uk/rss/newsonline_world_edition/americas/rss.xml");
$feeds = array();
$feeds = _querypath_examples_show_multiplerss($urls, 10);
foreach($feeds as $date => $item) {
$out .= '<p>' . l($item['title'], $item['link'])
.' <br />From: ' . $item['url']
.' <br />' . $item['desc']
.' <br />Published: ' . date("M d, Y H:m:s", $date) . '</p>';
}
?>
