How reliable is get_headers () for checking if a site is online?

How reliable is get_headers () function for checking if a site is online?

Basically:

    $check = get_headers($url,1);

      

So how reliable is this and can I depend on its accuracy?

+3


source to share


1 answer


If you want to use the results of get_headers () to input any other function, I won't rely on 100% accuracy. If you want to see the results with your own eyes (as I do) and correct or check any inconsistencies yourself, then that would be fine.

The results can be implemented by a number of things for both get_headers () and cURL. Personally, I run cURL against an array of all websites that I manage at least once a day while I'm at work, and usually I get a few false negatives. I used the get_headers () method, but in terms of false negatives, I didn't notice any difference. The reason I switched to cURL was because it gave better options in terms of returning error messages etc.



NOTE. If, like me, you run this against an array of sites you manage, I must point out that on many occasions this approach caused me to get sucked into a blacklist by my hosting provider because I was running this on at the same time. when they detected a brute force attack from elsewhere. Some phone calls for tech support and after a few weeks they started to recognize me when I called ... not good.

0


source







All Articles