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? 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. 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
Archived
This topic is now archived and is closed to further replies.