denoteone Posted January 28, 2010 Share Posted January 28, 2010 $url = 'http://www.maywebsite.com'; $str = file_get_contents($url); if (!$str){ echo 'can not connect'; }else{ do somthing else } is the above code the best way to check to make sure file_get_contents() works? Quote Link to comment https://forums.phpfreaks.com/topic/190159-write-if-statement-if-file_get_contents-fails/ Share on other sites More sharing options...
Alex Posted January 28, 2010 Share Posted January 28, 2010 Yes. Quote Link to comment https://forums.phpfreaks.com/topic/190159-write-if-statement-if-file_get_contents-fails/#findComment-1003300 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.