I need the fastet and smallest code to get the http respons code of any url(s)
Budget: $10 – $30 USD
I have been testing multiple scripts, but most of them are not fast. What I am looking for is a script that displays the http respons code of a url (like page or file). The fastest code I have now, is:
function getStatusCode($url) {
$headers = get_headers($url);
preg_match('/\s(\d+)\s/', $headers[0], $matches);
return $matches[0];
}
echo getStatusCode('https://www.freelancer.com/');
I need the fastest & shortest line of code to do this. This is because I want to do this on many pages & files per second. This could be wget --spider / curl or php code. As long as it runs on my linux webserver.
My intension is to make a script that checks all links on a webpage, and then as many pages as possible (later on with a database, to alert when there is a change in the number of 200 or 404 responses on a page).
At first, I need this requested code.
function getStatusCode($url) {
$headers = get_headers($url);
preg_match('/\s(\d+)\s/', $headers[0], $matches);
return $matches[0];
}
echo getStatusCode('https://www.freelancer.com/');
I need the fastest & shortest line of code to do this. This is because I want to do this on many pages & files per second. This could be wget --spider / curl or php code. As long as it runs on my linux webserver.
My intension is to make a script that checks all links on a webpage, and then as many pages as possible (later on with a database, to alert when there is a change in the number of 200 or 404 responses on a page).
At first, I need this requested code.