I am trying to merge two different RSS sources with the same structure into a single list concurrently. I have two foreach statements but would like to combine them. Problem I can not turn a DOM Method into an array... Thanks in Advance.

###### CODE BELOW Using DOM METHOD #####

<?php
foreach($rssResults1 as $value){
 echo('<div><a href="' . $value->childNodes->item($thing1)-> nodeValue . '">'); //Url
echo($value->childNodes->item($thing2)->nodeValue . '</a></div>'); //Title
   	    }
	    		    
foreach($rssResults2 as $value){
echo('<div><a href="' . $value->childNodes->item($thing11)->nodeValue . '">'); //Url
echo($value->childNodes->item($thing22)->nodeValue . '</a></div>'); //Title
	      }
?>

Why not use a ready-made script like RSSmesh to merge the feeds? It seems it would be much easier.

Talk you all for the help with combining two RSS feeds. I found that BuildaSearch has a an API which can combine two data sources into one.

Cheers!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.