Forum

HTTP/1.0 503 Service Unavailable error with Google News feed?

2011-05-16 22:36:42

meeble

Hello, I am trying to figure out why this is happening. I hope you'll be able to help. :) Here's my site: [url]buygoldusa.org/[/url] An you can see the error messages when trying to access this Google News RSS feed: [url]news.google.com/news?hl=en&q=gold+price&output=rss[/url] Also, when I enter that RSS url into your test page, it works fine: scriptol.com/rss/rss-single.php I am just using this code in my page:
require_once("rsslib.php");
$xml = ('news.google.com/news?hl=en&q=gold+price&output=rss');
echo RSS_Display($xml, 3);
Any ideas? Thanks, meeble
2011-05-17 02:56:33

scriptol

Hello, I have tested the reader with this feed on two sites: http://www.scriptol.com/rss/rss-single.php Works fine. http://www.scriptol.fr/rss/rss-simple.php Does not work. It is exactly the same code. But not same servers. I can not figure out what is the difference for now. Not the country apparently since you site is hosted in the USA. Could you try the reader with other feeds? My idea is that some servers allow to load a remote PHP file with parameters while others do not.
2011-05-17 03:05:03

meeble

Yes, your script works fine for many RSS feeds. When I changed from that Google news feed to several other feeds, the code works fine. I assume that Google is doing something to block the request. At first I tried to change PHP's user-agent, but so far that didn't help. I was hoping that you would have a solution. :\
2011-05-17 08:57:17

scriptol

This is not Google, this is probably parameters (stuff following ? in the URL). Have you tried other feeds with parameters? You may also test the Curl code that is commented in the source. [url=http://wiki.dreamhost.com/index.php/CURL]See the doc[/url]
2011-05-17 13:09:44

meeble

Yes, I have tried other feeds with parameters. Such as: [url]news.search.yahoo.com/rss?ei=UTF-8&p=gold+news&fr=news-us-ss[/url] which works fine. Several others like this work fine. The ONLY one that doesn't work is that Google News feed.
2011-05-18 13:02:51

scriptol

My last idea is in the doctype. You do not have a doctype in your site. Try to put this in the first line of the page:
<!DOCTYPE html>
The doctype is missing in the Google feed, while it is present in other examples.
2011-05-18 13:25:21

meeble

I added the <!DOCTYPE html> code, but still, the Google News feed doesn't work. Strange. What about on your two sites - one worked for that feed, and one didn't. What are the differences between those sites? - Devin
2011-05-19 05:09:08

meeble

No, the "http : //" was in the code, somehow it got removed when posting here. Very odd issue...
2011-05-19 09:13:41

scriptol

I have tried the cURL library on the two sites, with this code:
$url="http://news.google.com/news?hl=en&q=gold+price&output=rss";
$hnd=curl_init();
curl_setopt($hnd,CURLOPT_CONNECTTIMEOUT,5);
curl_setopt($hnd,CURLOPT_URL,$url);
$page=curl_exec($hnd);
curl_close($hnd);
$doc=new DOMDocument("1.0");
$doc->loadXML($page);
echo $doc->saveXML();
It works on the first host and not the other. This is definitively how PHP is configured on the server or maybe the version. This same PHP code works perfectly for the feed of Yahoo! on the two hosts.
2011-05-19 05:00:34

scriptol

The difference is in the host. Another point is the http:// missing in the URL of the feed. That could make a difference.