oskare100 Posted March 7, 2008 Share Posted March 7, 2008 Hello, I have the following code: $request = file_get_contents($request_url) or die("feed not loading"); If the file_get_contents($request_url) doesn't load/respond then the script echoes "feed not loading" and stops. I want the script to echo "feed not loading" and then continue and just skip that part of the script that needed the file contents. Is that possible? Best Regards Oskar R Quote Link to comment https://forums.phpfreaks.com/topic/94971-if-error-then-continue-and-not-die-possible/ Share on other sites More sharing options...
BlueSkyIS Posted March 7, 2008 Share Posted March 7, 2008 try removing the or die part? Quote Link to comment https://forums.phpfreaks.com/topic/94971-if-error-then-continue-and-not-die-possible/#findComment-486467 Share on other sites More sharing options...
Orio Posted March 7, 2008 Share Posted March 7, 2008 You can't use short-circuiting (... or die(); syntax) with echo. Make it an if: <?php if(!$request = file_get_contents($request_url)) echo "feed not loading"; ?> Orio. Quote Link to comment https://forums.phpfreaks.com/topic/94971-if-error-then-continue-and-not-die-possible/#findComment-486476 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.