1

When I look at the Google News feed in XML format, I'm not able to tell how to get the thumbnail image urls. Does anyone know how?

$news = simplexml_load_file('https://news.google.com/news?output=rss&topic=n');

foreach($news->channel->item as $item) {
    $title = $item->title . "\n";
    $link = $item->link . "\n";
    $pubDate = $item->pubDate . "\n";
    $image = $item-> ???? 

    echo $title . ' - ' . link . ' - ' . $image;
    echo strip_tags($item->description) ."\n";
    echo '<br><br>';
} 
WannaBaCODER
  • 61
  • 1
  • 1
  • 6
  • Those images aren’t separate XML nodes, but are part of the HTML code inside the `description` element. – CBroe Mar 29 '15 at 02:15
  • Please use the search before posting your question. Also make it clear how your question differs from existing material (and reference the existing material so it's viisble which part of the Q&A you've source already). – hakre Mar 29 '15 at 07:13
  • Also please see the reference question [How do you parse and process HTML/XML in PHP?](http://stackoverflow.com/q/3577641/367456) – hakre Mar 29 '15 at 07:16
  • I don;t see anything that explains how to get the image, this question has not been asked if so can you provide the link? Again I need to get the image from Google RSS feed in PHP – WannaBaCODER Mar 29 '15 at 16:11
  • Has been asked for sure before. You want to parse HTML that is within XML. This is typical for the Google RSS News Feed description element. Sorry I don't have the link at hand, but it has been asked more than once on how to parse HTML within XML. – hakre Mar 29 '15 at 17:19

0 Answers0