Hi,
I am trying to load an Rss link and add the data into an array. Here is what I am trying:
<?php
$doc = new DOMDocument();
$doc2 = new DOMDocument();
$bbcLink='http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/world/rss.xml';
$cnnLink='http://rss.cnn.com/rss/edition.rss';
$reutersLink='http://feeds.reuters.com/reuters/scienceNews';
$doc->load($bbcLink);
$arrFeeds = array();
foreach ($doc2->getElementsByTagName('item') as $node) {
$itemRSS = array (
'<p class="style1">' => $node->getElementsByTagName('title')->item(0)->nodeValue,
'</p>desc' => $node->getElementsByTagName('description')->item(0)->nodeValue,
'link'=>$node->getElementsByTagName('link')->item(0)->nodeValue,
'date' => $node->getElementsByTagName('pubDate')->item(0)->nodeValue
);
array_push($arrFeeds, $itemRSS);
}
function displayArrayContentFunction($arrayname,$tab="      ",$indent=0) {
$curtab ="";
$returnvalues = "";
while(list($key, $value) = each($arrayname)) {
for($i=0; $i<$indent; $i++) {
$curtab .= $tab;
}
if (is_array($value)) {
$returnvalues .= "<br /><table width='1009' border='1'><tr><td width='926'><br />\n";
$returnvalues .= displayArrayContentFunction($value,$tab,$indent+1)."</td><td width='67'> </td></tr></table><br />\n";
}
else $returnvalues .= "$curtab$key => $value<br />\n";
$curtab = NULL;
}
return $returnvalues;
}
echo displayArrayContentFunction($arrFeeds);
Now, I get an error Cannot clone object of class DOMDocument due to 'zend.ze1_compatibility_mode'.
I did change the value of zend.zel_compatibility=off both in php.ini and .htaccess file but still no luck. Please see if you can help, I really having a hard time with this.
PS. it does work on my localhost but not on the webserver when uploaded.
Many thanks in advance
?>