Simple code to check the http returned header code of ‘real world’ websites… I say real world websites as many servers these days block invalid user agent strings (mod_security plugins), so need to set a fake valid one first.
$user_agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071025 Firefox/3.0.0.1'; ini_set('user_agent', $user_agent); $url = "url to test here"; // eg http://www.google.com $urlinfo=get_headers($url); $statuscode= $urlinfo[0]; echo($url." ".$statuscode."\n");