Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in C:\wamp\www\asheesh\rs.php:36 Stack trace: #0 C:\wamp\www\asheesh\rs.php(36): SimpleXMLElement->__construct('', 16384) #1 {main} thrown in C:\wamp\www\asheesh\rs.php on line 36
Well, the root problem is as stated in the error message. If you want to avoid that ugly result being displayed to the user, you'll need to use a try/catch block to catch the exception and handle it in whatever way you'd like, e.g.:
After debugging the current issue, you may want to change the actual processing in the catch block to something more user-friendly for the live version.
PS: Please make use of this forum's [php]...[php] tags for PHP code sample, and [code]...[/code] tags for non-PHP code.
Last edited by NogDog; 05-15-2009 at 04:19 AM.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
I just realized I had a misplace parenthesis. The "catch" line should have been:
PHP Code:
catch(Exception $e)
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Sorry, that should be $e->getMessage() (not $e->get_message()).
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Bookmarks