You can user CURL to request a page and evaluate the response to determine if the page exists.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
function verify_domain($domain='') { $url = "http://" . $domain; $ch = curl_init($url); curl_setopt($ch, CURLOPT_NOBODY, true); curl_exec($ch); $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if($code >= 400) { return false; } return true; } |