Thursday, September 9, 2010

PHP - read an xml / rss


$doc = new DOMDocument();
$doc->load('http://www.yourlink.com/yourfile.xml');
$arrFeeds = array();
foreach ($doc->getElementsByTagName('item') as $node) {
$itemRSS = array (
'title' => $node->getElementsByTagName('title')->item(0)->nodeValue,
'pubDate' => $node->getElementsByTagName('pubDate')->item(0)->nodeValue
);
array_push($arrFeeds, $itemRSS);

$job_title = $itemRSS["title"];
$pub_date = $itemRSS["pubDate"];
?>

No comments:

Post a Comment