I am trying to create a PHP script that will check the status of an HTTP site as quickly as possible.
I am currently using get_headers () and running it in a loop of 200 random URLs from mysql database.
To test all 200 - it takes an average of 2 m 48 seconds.
Is there anything I can do to make this much faster?
(I know about fsockopen - it can check port 80 on 200 sites in the 20s - but it's not the same as asking for an http status code, because the server can respond to the port - but it may not load sites correctly, etc. .d.)
Here is the code.
<?php function get_httpcode($url) { $headers = get_headers($url, 0);
Clarkey
source share