Now easy to access and display cross domain feeds with php. With the use of DOMDocument() class we can easy access the feeds. In this given example I have fetched only the title and the link from the feeds. First of all start with the path from where you want to access the feeds, make sure that your path will be full with the complete URL, like I have mentioned on the given example. Then simply access the Tag of that feed/xml file with the member function getElementsByTagName(), and follow the code :
$feeds = 'http://blog.webtech11.com/feed'; $doc = new DOMDocument(); $data = $doc->load($feeds); $item = $doc->getElementsByTagName('item'); //Lastest Four Posts for($i=0; $i<=3; $i++){ $title = $item->item($i)->getElementsByTagName('title')->item(0)->childNodes->item(0)->nodeValue; $link = $item->item($i)->getElementsByTagName('link')->item(0)->childNodes->item(0)->nodeValue; echo '<a href="' . $link . '" target="_blank"><h2>' . $title . '</h2></a>'; }