关于php:CURLOPT_NOBODY是否仍下载主体-使用带宽

Does CURLOPT_NOBODY still download the body - using bandwidth

我正在用PHP执行cURL发布,并尝试减少我正在使用的带宽量。 我不需要从发布的远程站点返回任何东西,因为我控制了远程站点的所有跟踪以确保发布成功在接收端完成。

我的问题是...

当您将CURLOPT_NOBODY设置为TRUE时:

它是否仍会下载主体,而不会将其退还给您?

要么

它会忽略主体,根本不下载吗?


curl_setopt上的PHP手册(强调我的):

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.

因此,答案是否定的。 然后,它不会下载主体,因为它是一个HTTP HEAD请求:

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.