I'm new here but plan to become a regular! I'll leave my introduction to the intro's section though.
My issue at hand is that I need to be able to check a long list of URL for a certain criteria. Ill show you what I need to do, what I've done so far, and what I really could do with some help with! Then you can either move to the next thread or put me on the right track
What I need to know
I need to know whether the site is currently online or offline, which is pretty simple. However I need it to be able to tell the difference between online and a holding page. Preferably I'd like it to class all sites with a holding page as offline also.
What I have so far
Well so far I have ready many different websites with many different implementations of code to do the online offline bit. The issue I'm having it the holding page bit. What I think needs to happen is to some how get the code to search the sites source code for certain keywords to determine whether it is a holding page or not.
The best code I came across was the below, however would be happy for your professional opinions for alternatives
- Code: Select all
$agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";$ch=curl_init();
curl_setopt ($ch, CURLOPT_URL,$url );
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if($httpcode>=200 && $httpcode<300) return true;
else return false;
echo "Website OK"."n";
echo "Website DOWN";
If you know where i should be looking to solve my issues, i would be extremely grateful
Thanks in advance,