function urlExists($url=NULL) { if($url == NULL) return false; $ch = curl_init($url); curl_setopt($ch, CURLOPT_TIMEOUT, 5); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $data = curl_exec($ch); $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); return $httpcode >= 200 && $httpcode < 300; } function get_web_domain_exists($_url){ $result = array(); /* Execute Shell Command To Ping Target */ $cmd_result = shell_exec("ping -c 1 -w 1 ". $_url); /* Get Results From Ping */ $result = explode(",",$cmd_result); /* Return Server Status */ if ((preg_match("/(0 received)/i", $result[1])) || (preg_match("/(recibidos = 0)/i", $result[1]))) { return "offline"; } else if ((preg_match("/(1 received)/i", $result[1])) || (preg_match("/(recibidos =)/i", $result[1]))) { return "online"; } else{ return "unknown"; } }