PHP get Google News RSS Feed

If you know how to get the HTML data from the right XML-element (<description> in this case) you can just strip all HTML with PHP's strip_tags

This seems to work like you want it:

<?php
$news = simplexml_load_file('http://news.google.com.kh/news?pz=1&cf=all&ned=kh&hl=en&as_scoring=r&as_maxm=4&q=html5&as_qdr=a&as_drrb=q&as_mind=6&as_minm=3&cf=all&as_maxd=5&output=rss');

foreach($news->channel->item as $item) {
    
    echo "<h1>" . $item->title . "</h1>";
    echo '<p>' . strip_tags($item->description) ."</p>";
} 
?> 



Comments

Popular posts from this blog

PHP: Date Difference for PHP 5.2

HTML5 video loop src change on end play function

Custom OpenCart 2.3.0.2 theme