Skip to content

PHP code snippet – How to check if a url is up ?

<?php
$url = 'http://google.com';

if(@file_get_contents($url)){
	
	echo "Website is up";
	
} else {
	
	echo "Website is down";
	
}

?>
See also  How to loop through arraylist of objects in Java?
, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.