I'm currently using cURL to send GET requests. However, I do not need the returned value, as the requests are more of commands, to let my server know to execute a php file or change settings and such. In this case, would it be more economical to use HEAD instead of GET? I have no need for the returned document at all. 开发者_运维问答My second concern is if my server will interpret HEAD the same as GET, and will execute the functions.
So instead of:
GET /receiver.php?command=update_homepage
I want to use:
HEAD /receiver.php?command=update_homepage
You sure can use HEAD. The server will invoke your PHP script as normal, with "HEAD" in $_SERVER["REQUEST_METHOD"]
. Your script can act accordingly.
To send the request with cURL, set the option CURLOPT_NOBODY
with curl_setopt()
.
精彩评论