Shaun Posted November 3, 2008 Share Posted November 3, 2008 instead of $xml = simplexml_load_file($url) or die('Cannot retrieve feed'); could I do $xml = simplexml_load_file($url) or $xml = 0; ?? the reason I ask, is because my server sometimes plays up, and wont resolve names.. and instead of returning the error, or dieing.. I want to just return $xml as another value to check against in another script. Quote Link to comment https://forums.phpfreaks.com/topic/131265-solved-very-quick-and-simple-question/ Share on other sites More sharing options...
Prismatic Posted November 3, 2008 Share Posted November 3, 2008 simplexml_load_file() returns false when a file cannot be loaded, so you can simply remove the or xxx part and check $xml for false Quote Link to comment https://forums.phpfreaks.com/topic/131265-solved-very-quick-and-simple-question/#findComment-681568 Share on other sites More sharing options...
Shaun Posted November 3, 2008 Author Share Posted November 3, 2008 ah right ok, thanks Quote Link to comment https://forums.phpfreaks.com/topic/131265-solved-very-quick-and-simple-question/#findComment-681580 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.