Posts

Showing posts with the label rss

How to collect array indexes from different resources?

How to collect array indexes from different resources? I get data from 2 different URLs, But sometimes both have the same data. I only want to save the data in an array when the data is the same. Getting the data from first website: $a = 'http://firstwebsite.com'; $rss = simplexml_load_file($a); foreach ($rss->channel->item as $item) { $post['title'] = $item->title; $post['link'] = $item->link; $post['date'] = $item->pubDate; $post['description'] = $item->description; $articles = $post; } So that if I print the articles array: echo '<pre>'; print_r($articles); echo '</pre>'; I get: Array ( [0] => Array ( [title] => SimpleXMLElement Object ( [0] => First Item Title ) [link] => SimpleXMLElement Object ( [0] => http://firstitemlink.com ) [date] => SimpleXMLElem...