Does CURLOPT_NOBODY still download the body - using bandwidth

前端 未结 1 857
难免孤独
难免孤独 2020-12-15 09:02

I\'m performing a cURL post with PHP and trying to reduce the amount of bandwidth I am using. I don\'t need anything back from the remote site I am posting to since I contro

相关标签:
1条回答
  • 2020-12-15 09:27

    From the PHP manual on curl_setopt (emphasis mine):

    CURLOPT_NOBODY: TRUE to exclude the body from the output. Request method is then set to HEAD. Changing this to FALSE does not change it to GET.

    So, the answer is no. It won't download the body then because it is a HTTP HEAD request then:

    The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response. The metainformation contained in the HTTP headers in response to a HEAD request SHOULD be identical to the information sent in response to a GET request. This method can be used for obtaining metainformation about the entity implied by the request without transferring the entity-body itself. This method is often used for testing hypertext links for validity, accessibility, and recent modification.

    0 讨论(0)
提交回复
热议问题