I have a HTTP status check online tool here. It is made by PHP with cURL extension.
The trouble is some responses are good. Someone tell me that the url should be 302 redir or 200 Ok, but the tool shows 403 Forbidden.
After doing some search and study, I find the problem of some server that don’t accept the Header request only.
Anytime you set the option…
PHP Code:

curl_setopt($ch, CURLOPT_NOBODY, true);

CURLOPT_NOBODY automatically shifts the request to a HEAD, type request, so most servers don’t allow HEAD type requests, results most times in 403 errors, so you use…
PHP Code:

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, ‘GET’);

So cURL, will send the request as GET or POST, but still only really make a HEAD request because the CURLOPT_NOBODY flag was set to true, which causes cURL to read only up to the end of the response header.

The solution found here.

David Yin

David is a blogger, geek, and web developer — founder of FreeInOutBoard.com. If you like his post, you can say thank you here

Leave a Reply

Your email address will not be published. Required fields are marked *