curl postfields和upload readdata的区别

postfields为一次性上传所有内容,curl会自动计算filesize并附加在header中

postfields使用post方法(method默认为post),如果未在header中设置content-type,curl会自动设置为application/x-www-form-urlencoded。

(如果内容为xml,则有可能不自动设置)

upload 为指定一个文件句柄,默认上传所有文件内容,如果未通过infilesize设置filesize,curl会自动在header中加入Transfer-Encoding: chunked,但服务器有可能不支持此命令

猜你喜欢

转载自www.cnblogs.com/webkb/p/12059178.html