Online Schooling - Debt Consolidation - Debt Consolidation - Debt Consolidation - Credit Cards

PDA

View Full Version : error codes for simplexml


lruneh
Jan 23rd 2009, 11:53 am
Hi all

I'm using simplexml to parse some feeds. Sometimes simplexml returns an error because the feeds - for whatever reason - can't be parsed by simplexml.
What I'd like is to discard the ugly errors that simplexml returns and display a custom error in stead. Could someone please help me with that? I've tried "or die()" and if(!$xml){}

any help would be greatly appriciated! Thanks

Panzer
Jan 23rd 2009, 12:23 pm
Have you tried SimplePie? http://simplepie.org/ . It's essentially a framework for simplexml, makes things a whole lot easier. It can generate as well as consume RSS feeds. Theres plenty of tutorials and screencasts to help.

lruneh
Jan 23rd 2009, 12:51 pm
Hey Panzer
Thanks for your reply.
Unfortunately I'v built up my intire site using simplexml, so converting to simplepie is not really an option for me. I could ofcourse just turn off error reporting altogether, but it would seem rather strange for visitors if a particular feed just isn't showing...

joebert
Jan 24th 2009, 3:56 am
http://www.php.net/set_error_handler
http://www.php.net/restore_error_handler