Note that there are some explanatory texts on larger screens.

plurals
  1. POsimplepie not parsing google news rss feed
    primarykey
    data
    text
    <p>This code works perfectly with any other rss feed but not with google news feeds. I do not know what I am doing wrong, I think it's some bug. I keep getting this error when I try to read google news feeds</p> <p><code>This XML document is invalid, likely due to invalid characters. XML error: SYSTEM or PUBLIC, the URI is missing at line 1, column 61</code></p> <p>For example if we try the <code>http://stackoverflow.com/feeds</code> feeds it works nicely, but not with google news feeds. Can some one give me a hint?</p> <pre><code>&lt;?php //get the simplepie library require_once('simplepie.inc'); //grab the feed $feed = new SimplePie(); $feed-&gt;set_feed_url("http://news.google.com/news?hl=en&amp;gl=us&amp;q=austria&amp;ie=UTF-8&amp;output=rss"); $feed-&gt;force_feed(true); //$feed-&gt;encode_instead_of_strip(true); //enable caching $feed-&gt;enable_cache(true); //provide the caching folder $feed-&gt;set_cache_location('cache'); //set the amount of seconds you want to cache the feed $feed-&gt;set_cache_duration(1800); //init the process $feed-&gt;init(); //let simplepie handle the content type (atom, RSS...) $feed-&gt;handle_content_type(); ?&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt; &lt;title&gt;simple&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="page-wrap"&gt; &lt;h1&gt;News Finder&lt;/h1&gt; &lt;?php if ($feed-&gt;error): ?&gt; &lt;p&gt;&lt;?php echo $feed-&gt;error; ?&gt;&lt;/p&gt; &lt;?php endif; ?&gt; &lt;?php foreach ($feed-&gt;get_items() as $item): ?&gt; &lt;div class="chunk"&gt; &lt;h4 style="background:url(&lt;?php $feed = $item-&gt;get_feed(); echo $feed-&gt;get_favicon(); ?&gt;) no-repeat; text-indent: 25px; margin: 0 0 10px;"&gt;&lt;a href="&lt;?php echo $item-&gt;get_permalink(); ?&gt;"&gt;&lt;?php echo $item-&gt;get_title(); ?&gt;&lt;/a&gt;&lt;/h4&gt; &lt;p class="footnote"&gt;Source: &lt;a href="&lt;?php $feed = $item-&gt;get_feed(); echo $feed-&gt;get_permalink(); ?&gt;"&gt;&lt;?php $feed = $item-&gt;get_feed(); echo $feed-&gt;get_title(); ?&gt;&lt;/a&gt; | &lt;?php echo $item-&gt;get_date('j M Y | g:i a T'); ?&gt;&lt;/p&gt; &lt;/div&gt; &lt;?php endforeach; ?&gt; &lt;/div&gt; </code></pre> <p></p> <p></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload