Mega Code Archive

 
Categories / Php / Code Snippets
 

This example checks whether a link is valid or not

<?php $url = fsockopen("www.google.com", 80, &$errno, &$errstr, 30); if(!$url) { //site is down echo "<b>Google is <font color=\"red\">down!!</font></b>\n"; } //site is up else { echo("<a href=\"http://www.google.com\">Google</a>"); } ?>