Discussion board

To verify an RSS feed

?
2011-03-19 02:21:30

Chicco

Hi, Very good RSS reader. I need to check the URL of the stream before using it. Because if it is an invalid stream, then PHP errors are displayed on the screen. I'd like to avoid that. How do I verify a thread's URL? Thank you for the help you will be able to provide.
2011-03-21 02:34:27

scriptol

Hi Place the @ symbol before the PHP function to avoid error messages. This will be added in the next version.
2011-03-21 20:24:34

Chicco

Thank you for the response. I did what you suggested and more error messages. But now, if the tape is not genuine, the user gets a white screen where the error is. If there is any way to check the stream automatically and if it is invalid, then we will not execute the function. I set it up so that users add their own feeds and I'm sure people are at risk of putting bad streams somewhere. I would like to tell them that the flow is bad, not show errors or a white screen. How to check the correctness of the flow. Would that be possible? Can I just integrate the function into something like:
if(fonction erreur fatale){
   dire que le flux est brisé;
} else {
 exécuter la fonction;
}
Thanks for any help you can offer me.: D
2011-03-22 14:23:23

scriptol

Thread found with this function in RSS_Retrieve:
$doc->load($url);
This returns false if the stream is not loaded correctly. So, add a test:
if($doc->load($url) == false) return false;
At the end of the function, add:
return true;
And in the main function of the RSS_Display:
if(!RSS_Retrieve($url)) return false;
Or show any message with an echo.
if(!RSS_Retrieve($url)) { echo "Flux non valide"; return false; }