Home > Backend Development > PHP Tutorial > 这里讨论二个 PHP CURL CURLOPT 参数

这里讨论二个 PHP CURL CURLOPT 参数

WBOY
Release: 2016-06-23 13:27:41
Original
805 people have browsed it


CURLOPT_postfields 和 CURLOPT_httpheader


一,CURLOPT_HTTPHEADER :设置一个header中传输内容的数组。
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Range: Bytes=0-50\nOtherheader: stuff\n"));


curl_setopt($ch, CURLOPT_HTTPHEADER,array("Host: act.*.qq.com"));
相当于:
172.23.129.*  act.*.qq.com


二,CURLOPT_POSTFIELDS : 传递一个作为HTTP “POST”操作的所有数据的字符串。
curl_setopt($ch, CURLOPT_POSTFIELDS, 'Body=gfdfgdfgasdfgdfgdfgdfg& followup=672709&RootID=127437&star=58&TotalUseTable=Dv_bbs3& amp;UserName=→→敢死队→&signflag=1&total=65535');

在HTTP中的“POST”操作。如果要传送一个文件,需要一个@开头的文件名


所以,这二个参数做为 curl 调用方法是应该并存的。


参考:

http://blog.csdn.net/liuxinmingcode/article/details/8043150

版权声明:本文为博主原创文章,未经博主允许不得转载。

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template