Hi All, Recently I wrote a php script for checking the http return status code of webpages. The script will accept a url, get its source code, parse it to find out the child urls and check the status codes of these child urls. I am using cUrl and DomDocument for this. But i noticed that while checking some pages it is returning status code of '0' for some of the child urls. I know that 0 is not a valid status code and this might be a problem with headers. Please let me know if there is any possibility of overcoming this. Thanks in advance. Have a nice day!
Part of the code, that i am using for checking the status code, is given below $url = 'http://example.com/'; $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL,$url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); $page=curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch);
Sorry folks, it is my mistake only. When i parsed the source code for child urls, i was getting relative paths and this caused the response code to be '0'. Now I would have convert it into absolute url and hopefully this will correct the error. Can you please help me with this.