Discussion board

Error reading some threads

02-06-2010 06:40:17

trouble

Hello Bravo and thanks for this RSS player. I installed the script yesterday and am facing pb reading with some threads. For example, with The Jakarta Post, which also appears very well in Firefox 3.6, but not in IE8, I have the following message: "http://www.thejakartapost.com/channel/business/feed" Warning: DOMDocument:: load () [domdocument.load]: Entity'nbsp 'not defined in http://www.thejakartapost.com/channel/business/feed, line: 171 in/homez.156/businessjc/www/rsslib.php on line 77 And yet the code looks good when you look at the source. With Google News correctly displayed in localhost, I have this online (with both FF3.6 and IE8): [b] http://news.google.com/news?ned=in&topic=n&output=rss Warning: DOMDocument:: load (http://news.google.com/news?ned=in&topic=n&output=rss) [domdocument.load]: failed to open stream: HTTP request failed! HTTP/1.0 503 Service Unavailable in/homez.156/businessjc/www/rsslib.php on line 77 Warning: DOMDocument:: load () [domdocument.load]: I/O warning: failed to load external object "http://news.google.com/news?ned=in&topic=n&output=rss" in/homez.156/businessjc/www/rsslib.php on line 77 [/b] Line 77 contains this in the function RSS_Retrieve ($ url):
    $doc->load($url);
2 problems are very distinguishable. I have grouped them, but maybe they are better considered separately in your response? Thanks in advance.
03-06-2010 10:17:38

webmaster

Hello, I tested both streams under Internet Explorer 8, with a demo program: https://www.iqlevsha.ru/rss/rss-simple.php It works. You need to check with phpinfo () the PHP version, which should be version 5.
03-06-2010 11:08:57

trouble

Hello, we are talking about PHP5 both on the dev machine and on the hoster. By the way, the rest of the streams (about ten) offered on the site are working. In fact, the problem with The Jakarta Post flow disappeared from itself today with the deletion of [b] & nbsp [/b] reported in the error message: [b] Entity'nbsp 'not defined [/b] These characters were in the article description. Because the thread was updated by the publisher, the article disappeared from the thread. So more [u] of this [/u] problem... so far only one, only in localhost: "http://www.thejakartapost.com/channel/business/feed" notice: Trying to get property of non-object in C :\wamp2g\www\business-services-asia\commonlib.php on line 19 [/b] That is, on this line:
$y["description"] = $item->getElementsByTagName("description")->item(0)->firstChild->textContent;
Finally, this raises the broader question of other "inconsistencies" in the formation of xml files by their authors. Is there no other way to read streams that will bypass any imperfection that may arise at any time and be confident in the quality of the display on an ongoing basis? I tried to:
$fp = fsockopen($url);
$data = "";
while (!feof($fp)) 
{
    $data .= fgets($fp, 128);
}
fclose($fp);

$doc  = new DOMDocument();
$doc->loadXML($data);
and with:
$data = file_get_contents($url); 
$doc  = new DOMDocument();
$doc->loadXML($data);
Obviously, I had the same pb with both rss-direct.php and common-direct-rs.php. OK because 2 uses [b] load ($ url). Thanks again for what you're doing.
04-06-2010 17:27:13

webmaster

"Is there no other way to read streams that will bypass any imperfection that may arise at any time and be sure that the display quality will be constant?" If we divide reading into steps, as you did with fsockopen or as you can do with curl (see this stream: https://www.iqlevsha.ru/faq/viewtopic.php?id=97), you can always affect data before it is strewn with the loadXML function. In particular, you can eliminate special codes using str_replace or preg_replace.
05-06-2010 15:21:35

trouble

Thank you, so I will be working more deeply on the results returned by any of these features. If the results are conclusive enough, I will provide you with code to include in the script. Indeed, it may serve others to keep this "cleaning" module standard. Sincerely.