📜  php curl Content-Length - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:51.798000             🧑  作者: Mango

代码示例1
You shouldn't have to set the content-length yourself.
If you use cURL to send an HTTP POST, 
it will calculate the content length for you.

If you set the CURLOPT_POSTFIELDS value as an array,
it will automatically submit the request as multipart/form-data and use a boundary. 
If you pass a string, it will use application/x-www-form-urlencoded 
so make sure you pass a urlencoded string to CURLOPT_POSTFIELDS and
not an array since you want form-urlencoded.