I need a PHP script that reads the HTTP response code for each URL request.
something like
$headers = get_headers($theURL);
return substr($headers[0], 9, 3);
The problem is the get_headers() function is disabled at server level, as a policy.So it doesn’t work.
The question is how to get the HTTP response code for a URL?
If cURL is enabled, you can use it to get the whole header or just the response code. The following code assigns the response code to the
$response_codevariable:To get the whole header you can issue a HEAD request, like this: