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: Gecko/20071025 Firefox/';
ini_set('user_agent', $user_agent);

$url = "url to test here"; // eg
$statuscode= $urlinfo[0];

echo($url." ".$statuscode."\n");