curl_setopt

(PHP 4 >= 4.0.2, PHP 5, PHP 7)

curl_setopt锟斤拷锟斤拷 cURL 锟斤拷锟斤拷选锟斤拷

说锟斤拷

curl_setopt ( resource $ch , int $option , mixed $value ) : bool

为 cURL 锟结话锟斤拷锟斤拷锟斤拷锟窖★拷睢�

锟斤拷锟斤拷

ch

锟斤拷 curl_init() 锟斤拷锟截碉拷 cURL 锟斤拷锟斤拷锟�

option

锟斤拷要锟斤拷锟矫碉拷CURLOPT_XXX选锟筋。

value

锟斤拷锟斤拷锟斤拷锟斤拷option选锟斤拷锟较碉拷值锟斤拷

锟斤拷锟斤拷 option 锟斤拷锟斤拷锟斤拷 value应锟矫憋拷锟斤拷锟矫筹拷 bool 锟斤拷锟酵o拷

选锟斤拷 锟斤拷 value 锟斤拷锟斤拷为 锟斤拷注
CURLOPT_AUTOREFERER TRUE 时锟斤拷锟斤拷锟斤拷 Location: 锟截讹拷锟斤拷时锟斤拷锟皆讹拷锟斤拷锟斤拷 header 锟叫碉拷Referer:锟斤拷息锟斤拷
CURLOPT_BINARYTRANSFER 锟斤拷为 TRUE 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷 CURLOPT_RETURNTRANSFER 时锟斤拷锟斤拷锟斤拷原锟斤拷锟侥o拷Raw锟斤拷锟斤拷锟斤拷锟� 锟斤拷 PHP 5.1.3 锟斤拷始锟斤拷锟斤拷选锟筋不锟斤拷锟斤拷效锟斤拷锟斤拷使锟斤拷 CURLOPT_RETURNTRANSFER 锟斤拷锟斤拷锟角会返锟斤拷原锟斤拷锟侥o拷Raw锟斤拷锟斤拷锟捷★拷
CURLOPT_COOKIESESSION 锟斤拷为 TRUE 时锟斤拷锟斤拷锟斤拷锟铰碉拷一锟斤拷 cookie 锟结话锟斤拷锟斤拷锟斤拷强锟斤拷 libcurl 锟斤拷锟斤拷之前锟结话时锟斤拷锟斤拷锟斤拷锟� cookie锟斤拷 libcurl 锟斤拷默锟斤拷状锟斤拷锟斤拷锟斤拷锟斤拷锟角凤拷为锟结话锟斤拷锟斤拷锟结储锟芥、锟斤拷锟斤拷锟斤拷锟斤拷 cookie锟斤拷锟结话 cookie 锟斤拷指没锟叫癸拷锟斤拷时锟戒,只锟斤拷锟斤拷诨峄爸拷小锟�
CURLOPT_CERTINFO TRUE 锟斤拷锟节帮拷全锟斤拷锟斤拷时锟斤拷锟� SSL 证锟斤拷锟斤拷息锟斤拷 STDERR锟斤拷 锟斤拷 cURL 7.19.1 锟斤拷锟斤拷印锟� PHP 5.3.2 锟斤拷锟斤拷效锟斤拷 锟斤拷要锟斤拷锟斤拷 CURLOPT_VERBOSE 锟斤拷锟斤拷效锟斤拷
CURLOPT_CONNECT_ONLY TRUE 锟斤拷锟矫匡拷执锟斤拷锟斤拷锟斤拷锟斤拷要锟侥达拷锟斤拷锟斤拷证锟斤拷锟斤拷锟接癸拷锟教o拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟捷★拷锟斤拷选锟斤拷锟斤拷锟斤拷 HTTP锟斤拷SMTP 锟斤拷 POP3锟斤拷 锟斤拷 7.15.2 锟斤拷锟斤拷印锟� PHP 5.5.0 锟斤拷锟斤拷效锟斤拷
CURLOPT_CRLF 锟斤拷锟斤拷时锟斤拷Unix锟侥伙拷锟叫凤拷转锟斤拷锟缴回筹拷锟斤拷锟叫凤拷锟斤拷
CURLOPT_DNS_USE_GLOBAL_CACHE TRUE 锟斤拷锟斤拷锟斤拷一锟斤拷全锟街碉拷DNS锟斤拷锟芥。锟斤拷选锟斤拷锟斤拷叱贪锟饺拷模锟侥拷锟斤拷芽锟斤拷锟斤拷锟�
CURLOPT_FAILONERROR 锟斤拷 HTTP 状态锟斤拷锟斤拷诘锟斤拷锟� 400锟斤拷TRUE 锟斤拷锟斤拷锟斤拷示锟斤拷锟斤拷锟斤拷锟介。 默锟斤拷锟斤拷锟斤拷陆锟斤拷锟斤拷锟揭筹拷妫拷锟斤拷锟� HTTP 锟斤拷锟诫。
CURLOPT_SSL_FALSESTART TRUE 锟斤拷锟斤拷 TLS False Start 锟斤拷一锟斤拷 TLS 锟斤拷锟斤拷锟脚伙拷锟斤拷式锟斤拷 cURL 7.42.0 锟斤拷锟斤拷印锟斤拷锟� PHP 7.0.7 锟斤拷锟斤拷效锟斤拷
CURLOPT_FILETIME TRUE 时锟斤拷锟结尝锟皆伙拷取远锟斤拷锟侥碉拷锟叫碉拷锟睫革拷时锟斤拷锟斤拷息锟斤拷 锟斤拷息锟斤拷通锟斤拷curl_getinfo()锟斤拷锟斤拷锟斤拷CURLINFO_FILETIME 选锟斤拷锟饺★拷锟�
CURLOPT_FOLLOWLOCATION TRUE 时锟斤拷锟斤拷锟斤拷莘锟斤拷锟斤拷锟斤拷锟斤拷锟� HTTP 头锟叫碉拷 "Location: " 锟截讹拷锟津。o拷注锟解:锟斤拷锟角递癸拷模锟�"Location: " 锟斤拷锟酵硷拷锟轿撅拷锟截讹拷锟津几次o拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷 CURLOPT_MAXREDIRS锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷囟锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷
CURLOPT_FORBID_REUSE TRUE 锟斤拷锟斤拷山锟斤拷锟斤拷院锟角匡拷锟斤拷锟饺凤拷亩峡锟斤拷锟斤拷樱锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷映锟斤拷锟斤拷锟斤拷谩锟�
CURLOPT_FRESH_CONNECT TRUE 强锟狡伙拷取一锟斤拷锟铰碉拷锟斤拷锟接o拷锟斤拷锟斤拷锟角伙拷锟斤拷锟叫碉拷锟斤拷锟接★拷
CURLOPT_FTP_USE_EPRT TRUE 时锟斤拷锟斤拷 FTP 锟斤拷锟斤拷时锟斤拷使锟斤拷 EPRT (锟斤拷 LPRT)锟斤拷锟筋。 锟斤拷锟斤拷为 FALSE 时锟斤拷锟斤拷 EPRT 锟斤拷 LPRT锟斤拷锟斤拷锟斤拷使锟斤拷PORT 锟斤拷锟筋。
CURLOPT_FTP_USE_EPSV TRUE 时锟斤拷锟斤拷FTP锟斤拷锟斤拷锟斤拷锟斤拷校锟斤拷氐锟� PASV 模式前锟斤拷锟饺筹拷锟斤拷 EPSV 锟斤拷锟筋。锟斤拷锟斤拷为 FALSE 时锟斤拷锟斤拷 EPSV锟斤拷
CURLOPT_FTP_CREATE_MISSING_DIRS TRUE 时锟斤拷锟斤拷 ftp 锟斤拷锟斤拷锟斤拷锟斤拷锟节碉拷目录时锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷
CURLOPT_FTPAPPEND TRUE 为追锟斤拷写锟斤拷锟侥硷拷锟斤拷锟斤拷锟斤拷锟角革拷锟角★拷
CURLOPT_TCP_NODELAY TRUE 时锟斤拷锟斤拷 TCP 锟斤拷 Nagle 锟姐法锟斤拷锟斤拷锟角硷拷锟斤拷锟斤拷锟斤拷锟较碉拷小锟斤拷锟斤拷锟斤拷锟斤拷 PHP 5.2.1 锟斤拷效锟斤拷锟斤拷锟斤拷时锟斤拷要 libcurl 7.11.2 锟斤拷锟斤拷锟较★拷
CURLOPT_FTPASCII CURLOPT_TRANSFERTEXT 锟侥憋拷锟斤拷锟斤拷
CURLOPT_FTPLISTONLY TRUE 时只锟叫筹拷 FTP 目录锟斤拷锟斤拷锟街★拷
CURLOPT_HEADER 锟斤拷锟斤拷时锟结将头锟侥硷拷锟斤拷锟斤拷息锟斤拷为锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟�
CURLINFO_HEADER_OUT TRUE 时追锟劫撅拷锟斤拷锟斤拷锟斤拷锟斤拷址锟斤拷锟斤拷锟� 锟斤拷 PHP 5.1.3 锟斤拷始锟斤拷锟矫★拷CURLINFO_ 锟斤拷前缀锟斤拷锟斤拷锟斤拷锟�(intentional)锟斤拷
CURLOPT_HTTPGET TRUE 时锟斤拷锟斤拷锟斤拷 HTTP 锟斤拷 method 为 GET锟斤拷锟斤拷锟斤拷默锟斤拷锟斤拷 GET锟斤拷锟斤拷锟斤拷只锟斤拷 method 锟斤拷锟睫革拷时锟斤拷锟斤拷要锟斤拷锟窖★拷睢�
CURLOPT_HTTPPROXYTUNNEL TRUE 锟斤拷通锟斤拷指锟斤拷锟斤拷 HTTP 锟斤拷锟斤拷锟斤拷锟斤拷锟戒。
CURLOPT_MUTE TRUE 时锟斤拷锟斤拷全锟斤拷默锟斤拷锟斤拷锟斤拷锟角猴拷 cURL 锟斤拷锟斤拷锟斤拷 锟斤拷 cURL 7.15.5 锟斤拷锟狡筹拷锟斤拷锟斤拷锟斤拷使锟斤拷 CURLOPT_RETURNTRANSFER 锟斤拷为锟斤拷锟芥)
CURLOPT_NETRC TRUE 时锟斤拷锟斤拷锟斤拷锟接斤拷锟斤拷时锟斤拷锟斤拷锟斤拷~/.netrc锟侥硷拷锟斤拷取锟矫伙拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷远锟斤拷站锟姐。
CURLOPT_NOBODY TRUE 时锟斤拷锟斤拷锟斤拷锟� BODY 锟斤拷锟街★拷同时 Mehtod 锟斤拷锟斤拷锟� HEAD锟斤拷锟睫革拷为 FALSE 时锟斤拷锟斤拷锟斤拷 GET锟斤拷
CURLOPT_NOPROGRESS

TRUE 时锟截憋拷 cURL 锟侥达拷锟斤拷锟斤拷取锟�

Note:

PHP 默锟斤拷锟皆讹拷锟斤拷锟矫达拷选锟斤拷为 TRUE锟斤拷只锟斤拷为锟剿碉拷锟皆诧拷锟斤拷要锟侥憋拷锟斤拷锟矫★拷

CURLOPT_NOSIGNAL TRUE 时锟斤拷锟斤拷锟斤拷锟叫碉拷 cURL 锟斤拷锟捷革拷 PHP 锟斤拷锟叫碉拷锟脚号★拷锟斤拷 SAPI 锟斤拷锟竭程达拷锟斤拷时锟斤拷锟筋被默锟斤拷锟斤拷锟矫o拷锟斤拷锟皆筹拷时选锟斤拷锟斤拷锟斤拷使锟矫★拷 cURL 7.10时锟斤拷锟斤拷锟诫。
CURLOPT_PATH_AS_IS TRUE 锟斤拷锟斤拷锟斤拷 dot dot sequences 锟斤拷锟斤拷 ../ 锟斤拷 cURL 7.42.0 时锟斤拷锟斤拷锟诫。 PHP 7.0.7 锟斤拷锟斤拷效锟斤拷
CURLOPT_PIPEWAIT TRUE 锟斤拷却锟� pipelining/multiplexing锟斤拷 cURL 7.43.0 时锟斤拷锟斤拷锟诫。 PHP 7.0.7 锟斤拷锟斤拷效锟斤拷
CURLOPT_POST TRUE 时锟结发锟斤拷 POST 锟斤拷锟斤拷锟斤拷锟斤拷为锟斤拷application/x-www-form-urlencoded锟斤拷锟斤拷 HTML 锟斤拷锟结交时锟筋常锟斤拷锟斤拷一锟街★拷
CURLOPT_PUT TRUE 时锟斤拷锟斤拷 HTTP 锟斤拷锟斤拷锟侥硷拷锟斤拷要锟斤拷 PUT 锟斤拷锟侥硷拷锟斤拷锟斤拷锟斤拷 CURLOPT_INFILE锟斤拷CURLOPT_INFILESIZE 锟斤拷锟斤拷锟矫★拷
CURLOPT_RETURNTRANSFER TRUE 锟斤拷curl_exec()锟斤拷取锟斤拷锟斤拷息锟斤拷锟街凤拷锟斤拷锟斤拷锟截o拷锟斤拷锟斤拷锟斤拷直锟斤拷锟斤拷锟斤拷锟�
CURLOPT_SAFE_UPLOAD TRUE 锟斤拷锟斤拷 @ 前缀锟斤拷 CURLOPT_POSTFIELDS 锟叫凤拷锟斤拷锟侥硷拷锟斤拷 锟斤拷味锟斤拷 @ 锟斤拷锟斤拷锟斤拷锟街讹拷锟叫帮拷全锟斤拷使锟斤拷锟剿★拷 锟斤拷使锟斤拷 CURLFile 锟斤拷为锟较达拷锟侥达拷锟芥。 PHP 5.5.0 锟斤拷锟斤拷樱锟侥拷锟街� FALSE锟斤拷 PHP 5.6.0 锟斤拷默锟斤拷值为 TRUE锟斤拷. PHP 7 删锟斤拷锟剿达拷选锟筋, 锟斤拷锟斤拷使锟斤拷 CURLFile interface 锟斤拷锟较达拷锟侥硷拷锟斤拷
CURLOPT_SASL_IR TRUE 锟斤拷锟斤拷锟斤拷锟秸碉拷锟阶帮拷(first packet)锟斤拷锟酵筹拷始锟斤拷锟斤拷应(initial response)锟斤拷 cURL 7.31.10 锟斤拷锟斤拷樱锟斤拷锟� PHP 7.0.7 锟斤拷锟斤拷效锟斤拷
CURLOPT_SSL_ENABLE_ALPN FALSE 锟斤拷锟斤拷 SSL 锟斤拷锟斤拷锟叫碉拷 ALPN (锟斤拷锟� SSL 锟斤拷说锟� libcurl 锟节斤拷支锟斤拷) 锟斤拷锟斤拷协锟教碉拷 http2锟斤拷 cURL 7.36.0 锟斤拷锟斤拷锟接o拷 PHP 7.0.7 锟斤拷锟斤拷效锟斤拷
CURLOPT_SSL_ENABLE_NPN FALSE 锟斤拷锟斤拷 SSL 锟斤拷锟斤拷锟叫碉拷 NPN(锟斤拷锟� SSL 锟斤拷说锟� libcurl 锟节斤拷支锟斤拷)锟斤拷锟斤拷锟斤拷协锟教碉拷 http2锟斤拷 cURL 7.36.0 锟斤拷锟斤拷锟接o拷 PHP 7.0.7 锟斤拷锟斤拷效锟斤拷
CURLOPT_SSL_VERIFYPEER FALSE 锟斤拷止 cURL 锟斤拷证锟皆碉拷证锟介(peer's certificate锟斤拷锟斤拷要锟斤拷证锟侥斤拷锟斤拷证锟斤拷锟斤拷锟斤拷锟� CURLOPT_CAINFO 选锟斤拷锟斤拷锟斤拷锟矫o拷锟斤拷锟斤拷 CURLOPT_CAPATH锟斤拷锟斤拷锟斤拷证锟斤拷目录锟斤拷 锟斤拷cURL 7.10锟斤拷始默锟斤拷为 TRUE锟斤拷锟斤拷 cURL 7.10锟斤拷始默锟较绑定帮拷装锟斤拷
CURLOPT_SSL_VERIFYSTATUS TRUE 锟斤拷证证锟斤拷状态锟斤拷 cURL 7.41.0 锟斤拷锟斤拷樱锟� PHP 7.0.7 锟斤拷锟斤拷效锟斤拷
CURLOPT_TCP_FASTOPEN TRUE 锟斤拷锟斤拷 TCP Fast Open锟斤拷 cURL 7.49.0 锟斤拷锟斤拷樱锟� PHP 7.0.7 锟斤拷锟斤拷效锟斤拷
CURLOPT_TFTP_NO_OPTIONS TRUE 锟斤拷锟斤拷锟斤拷 TFTP 锟斤拷 options 锟斤拷锟斤拷 锟斤拷 cURL 7.48.0 锟斤拷樱锟� PHP 7.0.7 锟斤拷锟斤拷效锟斤拷
CURLOPT_TRANSFERTEXT TRUE 锟斤拷 FTP 锟斤拷锟斤拷使锟斤拷 ASCII 模式锟斤拷锟斤拷锟斤拷LDAP锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟侥憋拷锟斤拷息锟斤拷锟斤拷 HTML锟斤拷锟斤拷 Windows 系统锟较o拷系统锟斤拷锟斤拷锟� STDOUT 锟斤拷锟矫成讹拷锟斤拷锟斤拷 模式锟斤拷
CURLOPT_UNRESTRICTED_AUTH TRUE 锟斤拷使锟斤拷CURLOPT_FOLLOWLOCATION锟截讹拷锟斤拷 header 锟叫的讹拷锟� location 时锟斤拷锟斤拷锟斤拷锟斤拷锟矫伙拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷息锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟窖改变。
CURLOPT_UPLOAD TRUE 准锟斤拷锟较达拷锟斤拷
CURLOPT_VERBOSE TRUE 锟斤拷锟斤拷锟斤拷锟斤拷械锟斤拷锟较拷锟叫达拷氲�STDERR锟斤拷锟斤拷锟斤拷CURLOPT_STDERR锟斤拷指锟斤拷锟斤拷锟侥硷拷锟斤拷

锟斤拷锟斤拷 option锟斤拷value应锟矫憋拷锟斤拷锟矫筹拷 integer锟斤拷

选锟斤拷 锟斤拷锟斤拷value 锟斤拷注
CURLOPT_BUFFERSIZE 每锟轿讹拷锟斤拷幕锟斤拷锟侥尺寸。锟斤拷然锟斤拷锟斤拷证每锟轿讹拷锟斤拷锟斤拷全锟斤拷锟斤拷锟斤拷锟斤拷叽纭� 锟斤拷cURL 7.10锟叫憋拷锟斤拷锟诫。
CURLOPT_CLOSEPOLICY CURLCLOSEPOLICY_* 锟叫碉拷一锟斤拷锟斤拷

Note:

锟斤拷选锟斤拷锟窖憋拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟结被实锟街o拷锟斤拷远锟斤拷锟斤拷锟斤拷效锟斤拷锟斤拷锟斤拷

PHP 5.6.0 锟斤拷锟狡筹拷锟斤拷
CURLOPT_CONNECTTIMEOUT 锟节筹拷锟斤拷锟斤拷锟斤拷时锟饺达拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷为0锟斤拷锟斤拷锟斤拷锟睫等达拷锟斤拷
CURLOPT_CONNECTTIMEOUT_MS 锟斤拷锟斤拷锟斤拷锟接等达拷锟斤拷时锟戒,锟皆猴拷锟斤拷为锟斤拷位锟斤拷锟斤拷锟斤拷为0锟斤拷锟斤拷锟斤拷锟睫等达拷锟斤拷 锟斤拷锟� libcurl 锟斤拷锟斤拷时使锟斤拷系统锟斤拷准锟斤拷锟斤拷锟狡斤拷锟斤拷锟斤拷锟斤拷 standard system name resolver锟斤拷锟斤拷锟角诧拷锟街碉拷锟斤拷锟斤拷锟皆撅拷使锟斤拷锟斤拷锟斤拷频某锟绞憋拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷小锟斤拷时时锟戒还锟斤拷一锟斤拷锟接★拷 锟斤拷 cURL 7.16.2 锟叫憋拷锟斤拷锟诫。锟斤拷 PHP 5.2.3 锟斤拷始锟斤拷锟矫★拷
CURLOPT_DNS_CACHE_TIMEOUT 锟斤拷锟斤拷锟斤拷锟节达拷锟叫伙拷锟斤拷 DNS 锟斤拷时锟戒,默锟斤拷为120锟诫(锟斤拷锟斤拷锟接o拷锟斤拷
CURLOPT_EXPECT_100_TIMEOUT_MS 锟斤拷时预锟狡o拷 100锟斤拷锟斤拷锟节碉拷 continue 锟斤拷应 默锟斤拷为 1000 锟斤拷锟诫。 cURL 7.36.0 锟斤拷锟斤拷樱锟斤拷锟� PHP 7.0.7 锟斤拷效锟斤拷
CURLOPT_FTPSSLAUTH FTP锟斤拷证锟斤拷式锟斤拷锟斤拷锟矫碉拷时锟津)o拷CURLFTPAUTH_SSL (锟斤拷锟饺筹拷锟斤拷SSL)锟斤拷CURLFTPAUTH_TLS (锟斤拷锟饺筹拷锟斤拷TLS)锟斤拷CURLFTPAUTH_DEFAULT (锟斤拷cURL 锟皆革拷锟斤拷锟斤拷锟斤拷)锟斤拷 锟斤拷 cURL 7.12.2 锟叫憋拷锟斤拷锟诫。
CURLOPT_HEADEROPT How to deal with headers. One of the following constants: CURLHEADER_UNIFIED: the headers specified in CURLOPT_HTTPHEADER will be used in requests both to servers and proxies. With this option enabled, CURLOPT_PROXYHEADER will not have any effect. CURLHEADER_SEPARATE: makes CURLOPT_HTTPHEADER headers only get sent to a server and not to a proxy. Proxy headers must be set with CURLOPT_PROXYHEADER to get used. Note that if a non-CONNECT request is sent to a proxy, libcurl will send both server headers and proxy headers. When doing CONNECT, libcurl will send CURLOPT_PROXYHEADER headers only to the proxy and then CURLOPT_HTTPHEADER headers only to the server. Defaults to CURLHEADER_SEPARATE as of cURL 7.42.1, and CURLHEADER_UNIFIED before. Added in cURL 7.37.0. Available since PHP 7.0.7.
CURLOPT_HTTP_VERSION CURL_HTTP_VERSION_NONE (默锟斤拷值锟斤拷锟斤拷 cURL 锟皆硷拷锟叫讹拷使锟斤拷锟侥革拷锟芥本)锟斤拷CURL_HTTP_VERSION_1_0 (强锟斤拷使锟斤拷 HTTP/1.0)锟斤拷CURL_HTTP_VERSION_1_1 (强锟斤拷使锟斤拷 HTTP/1.1)锟斤拷
CURLOPT_HTTPAUTH

使锟矫碉拷 HTTP 锟斤拷证锟斤拷锟斤拷锟斤拷选锟斤拷锟叫o拷 CURLAUTH_BASIC锟斤拷 CURLAUTH_DIGEST锟斤拷 CURLAUTH_GSSNEGOTIATE锟斤拷 CURLAUTH_NTLM锟斤拷 CURLAUTH_ANY锟斤拷 CURLAUTH_ANYSAFE锟斤拷

锟斤拷锟斤拷使锟斤拷 | 位锟斤拷(OR)锟斤拷锟斤拷锟斤拷锟斤拷隙锟斤拷值锟斤拷cURL 锟斤拷锟矫凤拷锟斤拷锟斤拷选锟斤拷锟斤拷支锟街的凤拷锟斤拷锟斤拷锟斤拷选锟斤拷锟斤拷玫锟斤拷歉锟斤拷锟�

CURLAUTH_ANY锟斤拷 CURLAUTH_BASIC | CURLAUTH_DIGEST | CURLAUTH_GSSNEGOTIATE | CURLAUTH_NTLM 锟侥憋拷锟斤拷锟斤拷

CURLAUTH_ANYSAFE 锟斤拷 CURLAUTH_DIGEST | CURLAUTH_GSSNEGOTIATE | CURLAUTH_NTLM 锟侥憋拷锟斤拷锟斤拷

CURLOPT_INFILESIZE 希锟斤拷锟斤拷锟斤拷远锟斤拷站锟斤拷锟斤拷募锟斤拷叽纾拷纸锟�(byte)为锟斤拷位锟斤拷 注锟斤拷锟睫凤拷锟斤拷锟斤拷锟窖★拷锟斤拷锟街� libcurl 锟斤拷锟酵革拷锟斤拷锟斤拷锟斤拷荩锟饺凤拷蟹锟斤拷锟绞裁慈★拷锟斤拷锟� CURLOPT_READFUNCTION锟斤拷
CURLOPT_LOW_SPEED_LIMIT 锟斤拷锟斤拷锟劫度o拷每锟斤拷锟街节o拷bytes锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷CURLOPT_LOW_SPEED_TIME锟斤拷锟斤拷统锟斤拷锟角凤拷锟斤拷太锟斤拷锟斤拷取锟斤拷锟斤拷锟戒。
CURLOPT_LOW_SPEED_TIME 锟斤拷锟斤拷锟斤拷锟劫讹拷小锟斤拷CURLOPT_LOW_SPEED_LIMIT时(bytes/sec)锟斤拷PHP锟斤拷锟叫讹拷锟角凤拷锟斤拷太锟斤拷锟斤拷取锟斤拷锟斤拷锟戒。
CURLOPT_MAXCONNECTS 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤到锟斤拷锟斤拷时锟斤拷锟斤拷通锟斤拷CURLOPT_CLOSEPOLICY锟斤拷锟斤拷应锟矫关憋拷锟斤拷些锟斤拷锟接★拷
CURLOPT_MAXREDIRS 指锟斤拷锟斤拷锟斤拷 HTTP 锟截讹拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷选锟斤拷锟角猴拷CURLOPT_FOLLOWLOCATION一锟斤拷使锟矫的★拷
CURLOPT_PORT 锟斤拷锟斤拷指锟斤拷锟斤拷锟接端口★拷
CURLOPT_POSTREDIR 位锟斤拷锟诫, 1 (301 锟斤拷锟斤拷锟截讹拷锟斤拷), 2 (302 Found) 锟斤拷 4 (303 See Other) 锟斤拷锟斤拷 CURLOPT_FOLLOWLOCATION 时锟斤拷什么锟斤拷锟斤拷锟斤拷锟揭拷俅锟� HTTP POST 锟斤拷锟截讹拷锟斤拷锟斤拷址锟斤拷 cURL 7.19.1 锟斤拷锟斤拷樱锟絇HP 5.3.2 锟斤拷始锟斤拷锟矫★拷
CURLOPT_PROTOCOLS

CURLPROTO_*锟斤拷位锟斤拷锟诫。 锟斤拷锟斤拷时锟斤拷锟斤拷锟斤拷锟斤拷 libcurl 锟节达拷锟斤拷锟斤拷锟斤拷锌锟绞癸拷锟斤拷锟叫┬拷椤� 锟解将锟斤拷锟斤拷锟斤拷锟节憋拷锟斤拷libcurl时支锟斤拷锟节讹拷协锟介,锟斤拷锟斤拷锟斤拷锟斤拷只锟斤拷锟斤拷锟斤拷锟斤拷蛹锟斤拷锟侥拷锟� libcurl 锟斤拷使锟斤拷锟斤拷锟斤拷支锟街碉拷协锟介。 锟轿硷拷CURLOPT_REDIR_PROTOCOLS锟斤拷

锟斤拷锟矫碉拷协锟斤拷选锟斤拷为锟斤拷 CURLPROTO_HTTP锟斤拷 CURLPROTO_HTTPS锟斤拷 CURLPROTO_FTP锟斤拷 CURLPROTO_FTPS锟斤拷 CURLPROTO_SCP锟斤拷 CURLPROTO_SFTP锟斤拷 CURLPROTO_TELNET锟斤拷 CURLPROTO_LDAP锟斤拷 CURLPROTO_LDAPS锟斤拷 CURLPROTO_DICT锟斤拷 CURLPROTO_FILE锟斤拷 CURLPROTO_TFTP锟斤拷 CURLPROTO_ALL锟斤拷

锟斤拷 cURL 7.19.4 锟叫憋拷锟斤拷锟诫。
CURLOPT_PROXYAUTH HTTP 锟斤拷锟斤拷锟斤拷锟接碉拷锟斤拷证锟斤拷式锟斤拷使锟斤拷锟斤拷CURLOPT_HTTPAUTH锟叫碉拷位锟斤拷锟诫。 锟斤拷前锟斤拷锟斤拷支锟斤拷 CURLAUTH_BASIC锟斤拷CURLAUTH_NTLM锟斤拷 锟斤拷 cURL 7.10.7 锟叫憋拷锟斤拷锟诫。
CURLOPT_PROXYPORT 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷亩丝凇锟斤拷丝锟揭诧拷锟斤拷锟斤拷锟�CURLOPT_PROXY锟斤拷锟斤拷锟矫★拷
CURLOPT_PROXYTYPE 锟斤拷锟斤拷锟斤拷 CURLPROXY_HTTP (默锟斤拷值) CURLPROXY_SOCKS4锟斤拷 CURLPROXY_SOCKS5锟斤拷 CURLPROXY_SOCKS4A 锟斤拷 CURLPROXY_SOCKS5_HOSTNAME锟斤拷 锟斤拷 cURL 7.10 锟叫憋拷锟斤拷锟诫。
CURLOPT_REDIR_PROTOCOLS CURLPROTO_* 值锟斤拷位锟斤拷锟诫。锟斤拷锟斤拷锟斤拷锟斤拷茫锟轿伙拷锟斤拷锟斤拷锟斤拷锟斤拷 libcurl 锟斤拷 CURLOPT_FOLLOWLOCATION锟斤拷锟斤拷时锟斤拷使锟矫碉拷协锟介。 默锟斤拷锟斤拷锟斤拷锟� FILE 锟斤拷 SCP 锟斤拷锟斤拷锟斤拷协锟介。 锟斤拷锟� 7.19.4 前锟侥版本锟斤拷锟斤拷锟斤拷支锟斤拷锟斤拷锟斤拷支锟街碉拷协锟介不同锟斤拷锟斤拷锟斤拷协锟介常锟斤拷锟斤拷锟斤拷锟斤拷锟�CURLOPT_PROTOCOLS锟斤拷 锟斤拷 cURL 7.19.4 锟叫憋拷锟斤拷锟诫。
CURLOPT_RESUME_FROM 锟节恢革拷锟斤拷锟斤拷时锟斤拷锟斤拷锟斤拷锟街斤拷为锟斤拷位锟斤拷偏锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟较碉拷锟斤拷锟斤拷锟斤拷锟斤拷
CURLOPT_SSL_OPTIONS Set SSL behavior options, which is a bitmask of any of the following constants: CURLSSLOPT_ALLOW_BEAST: do not attempt to use any workarounds for a security flaw in the SSL3 and TLS1.0 protocols. CURLSSLOPT_NO_REVOKE: disable certificate revocation checks for those SSL backends where such behavior is present. Added in cURL 7.25.0. Available since PHP 7.0.7.
CURLOPT_SSL_VERIFYHOST 锟斤拷锟斤拷为 1 锟角硷拷锟斤拷锟斤拷锟斤拷SSL证锟斤拷锟斤拷锟角凤拷锟斤拷锟揭伙拷锟斤拷锟斤拷锟斤拷锟�(common name)锟斤拷锟斤拷锟斤拷注锟斤拷锟斤拷锟斤拷锟斤拷(Common Name)一锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷写锟姐将要锟斤拷锟斤拷SSL证锟斤拷锟斤拷锟斤拷锟� (domain)锟斤拷锟斤拷锟斤拷锟斤拷(sub domain)锟斤拷 锟斤拷锟矫筹拷 2锟斤拷锟斤拷锟介公锟斤拷锟斤拷锟角凤拷锟斤拷冢锟斤拷锟斤拷锟斤拷欠锟斤拷锟斤拷峁╋拷锟斤拷锟斤拷锟斤拷锟狡ワ拷洹� 0 为锟斤拷锟斤拷锟斤拷锟斤拷啤锟� 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟叫o拷锟斤拷锟街涤︼拷锟斤拷锟� 2锟斤拷默锟斤拷值锟斤拷锟斤拷 1 锟斤拷支锟斤拷锟斤拷 cURL 7.28.1 锟叫憋拷删锟斤拷锟剿★拷
CURLOPT_SSLVERSION CURL_SSLVERSION_DEFAULT (0), CURL_SSLVERSION_TLSv1 (1), CURL_SSLVERSION_SSLv2 (2), CURL_SSLVERSION_SSLv3 (3), CURL_SSLVERSION_TLSv1_0 (4), CURL_SSLVERSION_TLSv1_1 (5) 锟斤拷 CURL_SSLVERSION_TLSv1_2 (6) 锟叫碉拷锟斤拷锟斤拷一锟斤拷锟斤拷

Note:

锟斤拷锟斤拷帽锟斤拷锟斤拷锟斤拷锟斤拷值锟斤拷锟斤拷锟斤拷使锟斤拷默锟斤拷值锟斤拷 锟斤拷锟斤拷为 2 锟斤拷 3 锟饺斤拷危锟秸o拷锟斤拷 SSLv2 锟斤拷 SSLv3 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷凇锟�

CURLOPT_STREAM_WEIGHT 锟斤拷锟斤拷 stream weight 锟斤拷值 ( 1 锟斤拷 256 之锟斤拷锟斤拷锟斤拷锟�). cURL 7.46.0 锟斤拷锟斤拷樱锟斤拷锟� PHP 7.0.7 锟斤拷锟斤拷效锟斤拷
CURLOPT_TIMECONDITION 锟斤拷锟斤拷锟斤拷味源锟� CURLOPT_TIMEVALUE锟斤拷 使锟斤拷 CURL_TIMECOND_IFMODSINCE锟斤拷锟斤拷锟斤拷页锟斤拷 CURLOPT_TIMEVALUE 之锟斤拷锟睫改o拷锟脚凤拷锟斤拷页锟芥。没锟斤拷锟睫革拷锟津返伙拷 "304 Not Modified" 头锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷 CURLOPT_HEADERTRUE锟斤拷CURL_TIMECOND_IFUNMODSINCE锟斤拷锟斤拷锟洁反锟斤拷效锟斤拷锟斤拷 默锟斤拷为 CURL_TIMECOND_IFMODSINCE锟斤拷
CURLOPT_TIMEOUT 锟斤拷锟斤拷 cURL 锟斤拷锟斤拷执锟叫碉拷锟筋长锟斤拷锟斤拷锟斤拷
CURLOPT_TIMEOUT_MS 锟斤拷锟斤拷cURL锟斤拷锟斤拷执锟叫碉拷锟筋长锟斤拷锟斤拷锟斤拷锟斤拷 锟斤拷锟� libcurl 锟斤拷锟斤拷时使锟斤拷系统锟斤拷准锟斤拷锟斤拷锟狡斤拷锟斤拷锟斤拷锟斤拷 standard system name resolver锟斤拷锟斤拷锟角诧拷锟街碉拷锟斤拷锟斤拷锟皆撅拷使锟斤拷锟斤拷锟斤拷频某锟绞憋拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷小锟斤拷时时锟戒还锟斤拷一锟斤拷锟接★拷 锟斤拷 cURL 7.16.2 锟叫憋拷锟斤拷锟诫。锟斤拷 PHP 5.2.3 锟斤拷锟绞癸拷谩锟�
CURLOPT_TIMEVALUE 锟斤拷锟斤拷锟斤拷锟斤拷 1970锟斤拷1锟斤拷1锟秸匡拷始锟斤拷锟斤拷锟绞憋拷锟结被 CURLOPT_TIMECONDITION使锟斤拷默锟斤拷使锟斤拷CURL_TIMECOND_IFMODSINCE锟斤拷
CURLOPT_MAX_RECV_SPEED_LARGE 锟斤拷锟斤拷锟斤拷锟斤拷俣瘸锟斤拷锟斤拷舜锟斤拷俣锟�(锟斤拷每锟斤拷锟街斤拷锟斤拷锟斤拷统锟斤拷) 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷奂频锟狡斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟酵会降锟劫碉拷锟斤拷锟斤拷锟斤拷锟斤拷锟街碉拷锟侥拷喜锟斤拷锟斤拷佟锟� cURL 7.15.5 锟斤拷锟斤拷樱锟� PHP 5.4.0 锟斤拷效锟斤拷
CURLOPT_MAX_SEND_SPEED_LARGE 锟斤拷锟斤拷洗锟斤拷锟斤拷俣瘸锟斤拷锟斤拷舜锟斤拷俣锟�(锟斤拷每锟斤拷锟街斤拷锟斤拷锟斤拷统锟斤拷)锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷奂频锟狡斤拷锟斤拷锟� 锟斤拷锟斤拷锟斤拷突峤碉拷俚锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷值锟斤拷默锟较诧拷锟斤拷锟劫★拷 cURL 7.15.5 锟斤拷锟斤拷樱锟� PHP 5.4.0 锟斤拷效锟斤拷
CURLOPT_SSH_AUTH_TYPES A bitmask consisting of one or more of CURLSSH_AUTH_PUBLICKEY, CURLSSH_AUTH_PASSWORD, CURLSSH_AUTH_HOST, CURLSSH_AUTH_KEYBOARD. Set to CURLSSH_AUTH_ANY to let libcurl pick one. cURL 7.16.1 锟斤拷锟斤拷印锟�
CURLOPT_IPRESOLVE 锟斤拷锟斤拷锟斤拷锟窖★拷锟斤拷锟揭拷锟斤拷锟斤拷锟� IP 锟斤拷址锟斤拷锟街伙拷锟斤拷诘锟街凤拷卸锟斤拷锟� ip 锟斤拷锟斤拷时锟斤拷锟斤拷锟斤拷茫锟斤拷锟斤拷缘锟街碉拷校锟� CURL_IPRESOLVE_WHATEVER锟斤拷 CURL_IPRESOLVE_V4锟斤拷 CURL_IPRESOLVE_V6锟斤拷默锟斤拷锟斤拷 CURL_IPRESOLVE_WHATEVER锟斤拷 cURL 7.10.8 锟斤拷锟斤拷印锟�
CURLOPT_FTP_FILEMETHOD 锟斤拷锟斤拷 curl 使锟斤拷锟斤拷锟街凤拷式锟斤拷锟斤拷取 FTP(s) 锟斤拷锟斤拷锟斤拷锟较碉拷锟侥硷拷锟斤拷锟斤拷锟杰碉拷值锟叫o拷 CURLFTPMETHOD_MULTICWD锟斤拷 CURLFTPMETHOD_NOCWD 锟斤拷 CURLFTPMETHOD_SINGLECWD锟斤拷 cURL 7.15.1 锟斤拷锟斤拷樱锟� PHP 5.3.0 锟斤拷锟斤拷效锟斤拷

锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟叫�option锟斤拷value应锟矫憋拷锟斤拷锟矫筹拷 string锟斤拷

选锟斤拷 锟斤拷锟矫碉拷value 锟斤拷注
CURLOPT_CAINFO 一锟斤拷锟斤拷锟斤拷锟斤拷1锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟矫凤拷锟斤拷锟斤拷锟街わ拷锟街わ拷锟斤拷锟侥硷拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷诤锟�CURLOPT_SSL_VERIFYPEER一锟斤拷使锟斤拷时锟斤拷锟斤拷锟斤拷锟藉。 . 锟斤拷锟斤拷锟斤拷要锟斤拷锟斤拷路锟斤拷锟斤拷
CURLOPT_CAPATH 一锟斤拷锟斤拷锟斤拷锟脚讹拷锟紺A证锟斤拷锟侥柯硷拷锟斤拷锟斤拷选锟斤拷锟角猴拷CURLOPT_SSL_VERIFYPEER一锟斤拷使锟矫的★拷
CURLOPT_COOKIE 锟借定 HTTP 锟斤拷锟斤拷锟斤拷"Cookie: "锟斤拷锟街碉拷锟斤拷锟捷★拷锟斤拷锟� cookie 锟矫分号分革拷锟斤拷锟街号猴拷锟揭伙拷锟斤拷崭锟�(锟斤拷锟界, "fruit=apple; colour=red")锟斤拷
CURLOPT_COOKIEFILE 锟斤拷锟斤拷 cookie 锟斤拷锟捷碉拷锟侥硷拷锟斤拷锟斤拷cookie 锟侥硷拷锟侥革拷式锟斤拷锟斤拷锟斤拷 Netscape 锟斤拷式锟斤拷锟斤拷锟斤拷只锟角达拷 HTTP 头锟斤拷锟斤拷瘢锟斤拷锟斤拷募锟斤拷锟斤拷锟斤拷锟侥硷拷锟斤拷锟角空的o拷锟斤拷锟斤拷锟斤拷锟� cookie锟斤拷锟斤拷 cookie 锟侥达拷锟斤拷锟皆撅拷锟斤拷锟矫★拷
CURLOPT_COOKIEJAR 锟斤拷锟接斤拷锟斤拷锟襟,憋拷锟界,锟斤拷锟斤拷 curl_close 锟襟,憋拷锟斤拷 cookie 锟斤拷息锟斤拷锟侥硷拷锟斤拷
CURLOPT_CUSTOMREQUEST

HTTP 锟斤拷锟斤拷时锟斤拷使锟斤拷锟皆讹拷锟斤拷锟� Method 锟斤拷锟斤拷锟斤拷"GET"锟斤拷"HEAD"锟斤拷锟斤拷 "DELETE" 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟轿碉拷 HTTP 锟斤拷锟斤拷锟斤拷锟矫★拷 锟斤拷效值锟斤拷 "GET"锟斤拷"POST"锟斤拷"CONNECT"锟饺等o拷也锟斤拷锟斤拷说锟斤拷锟斤拷要锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷 HTTP 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷"GET /index.html HTTP/1.0\r\n\r\n"锟角诧拷锟斤拷确锟侥★拷

Note:

锟斤拷确锟斤拷锟斤拷锟斤拷锟斤拷支锟斤拷锟斤拷锟斤拷远锟斤拷宸斤拷锟斤拷锟揭癸拷锟斤拷锟斤拷锟�

CURLOPT_DEFAULT_PROTOCOL

URL锟斤拷锟斤拷协锟斤拷锟绞憋拷锟绞癸拷玫锟侥拷锟叫拷椤�

cURL 7.45.0 锟斤拷锟斤拷樱锟斤拷锟� PHP 7.0.7 锟斤拷锟斤拷效锟斤拷
CURLOPT_DNS_INTERFACE

Set the name of the network interface that the DNS resolver should bind to. This must be an interface name (not an address).

Added in cURL 7.33.0. Available since PHP 7.0.7.
CURLOPT_DNS_LOCAL_IP4

Set the local IPv4 address that the resolver should bind to. The argument should contain a single numerical IPv4 address as a string.

Added in cURL 7.33.0. Available since PHP 7.0.7.
CURLOPT_DNS_LOCAL_IP6

Set the local IPv6 address that the resolver should bind to. The argument should contain a single numerical IPv6 address as a string.

Added in cURL 7.33.0. Available since PHP 7.0.7.
CURLOPT_EGDSOCKET 锟斤拷锟斤拷CURLOPT_RANDOM_FILE锟斤拷锟斤拷锟斤拷一锟斤拷Entropy Gathering Daemon锟阶斤拷锟街★拷
CURLOPT_ENCODING HTTP锟斤拷锟斤拷头锟斤拷"Accept-Encoding: "锟斤拷值锟斤拷 锟斤拷使锟斤拷锟杰癸拷锟斤拷锟斤拷锟斤拷应锟斤拷锟斤拷锟捷★拷 支锟街的憋拷锟斤拷锟斤拷"identity"锟斤拷"deflate"锟斤拷"gzip"锟斤拷锟斤拷锟轿拷锟斤拷址锟斤拷锟�""锟斤拷锟结发锟斤拷锟斤拷锟斤拷支锟街的憋拷锟斤拷锟斤拷锟酵★拷 锟斤拷 cURL 7.10 锟叫憋拷锟斤拷锟诫。
CURLOPT_FTPPORT 锟斤拷锟街碉拷锟斤拷锟斤拷锟斤拷锟斤拷锟饺★拷锟紽TP"PORT"指锟斤拷锟斤拷锟斤拷要锟斤拷IP锟斤拷址锟斤拷 "PORT" 指锟斤拷锟斤拷锟皆讹拷谭锟斤拷锟斤拷锟斤拷锟斤拷拥锟斤拷锟斤拷锟街革拷锟斤拷锟絀P锟斤拷址锟斤拷锟斤拷锟斤拷址锟斤拷锟斤拷锟斤拷锟斤拷谴锟斤拷谋锟斤拷锟絀P锟斤拷址锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷一锟斤拷锟斤拷锟斤拷涌锟斤拷锟斤拷锟経NIX锟铰o拷锟斤拷锟斤拷只锟斤拷一锟斤拷'-'锟斤拷使锟斤拷默锟较碉拷 IP 锟斤拷址锟斤拷
CURLOPT_INTERFACE 锟斤拷锟酵碉拷锟斤拷锟斤拷涌冢锟絠nterface锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷一锟斤拷锟接匡拷锟斤拷锟斤拷IP 锟斤拷址锟斤拷锟斤拷锟斤拷一锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷
CURLOPT_KEYPASSWD 使锟斤拷 CURLOPT_SSLKEY 锟斤拷 CURLOPT_SSH_PRIVATE_KEYFILE 私钥时锟斤拷锟斤拷锟斤拷搿� 锟斤拷 cURL 7.16.1 锟斤拷锟斤拷印锟�
CURLOPT_KRB4LEVEL KRB4 (Kerberos 4) 锟斤拷全锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷魏锟街碉拷锟斤拷锟斤拷锟叫э拷锟�(锟接低碉拷锟竭碉拷顺锟斤拷)锟斤拷"clear"锟斤拷"safe"锟斤拷"confidential"锟斤拷"private".锟斤拷锟斤拷锟斤拷址锟斤拷锟斤拷锟斤拷锟斤拷锟叫╋拷锟斤拷锟绞癸拷锟�"private"锟斤拷 锟斤拷锟窖★拷锟斤拷锟斤拷锟轿� NULL 时锟斤拷锟斤拷锟斤拷 KRB4 锟斤拷全锟斤拷证锟斤拷目前 KRB4 锟斤拷全锟斤拷证只锟斤拷锟斤拷锟斤拷 FTP 锟斤拷锟戒。
CURLOPT_LOGIN_OPTIONS Can be used to set protocol specific login options, such as the preferred authentication mechanism via "AUTH=NTLM" or "AUTH=*", and should be used in conjunction with the CURLOPT_USERNAME option. Added in cURL 7.34.0. Available since PHP 7.0.7.
CURLOPT_PINNEDPUBLICKEY Set the pinned public key. The string can be the file name of your pinned public key. The file format expected is "PEM" or "DER". The string can also be any number of base64 encoded sha256 hashes preceded by "sha256//" and separated by ";". Added in cURL 7.39.0. Available since PHP 7.0.7.
CURLOPT_POSTFIELDS 全锟斤拷锟斤拷锟斤拷使锟斤拷HTTP协锟斤拷锟叫碉拷 "POST" 锟斤拷锟斤拷锟斤拷锟斤拷锟酵★拷 要锟斤拷锟斤拷锟侥硷拷锟斤拷锟斤拷锟侥硷拷锟斤拷前锟斤拷锟斤拷锟�@前缀锟斤拷使锟斤拷锟斤拷锟斤拷路锟斤拷锟斤拷 锟侥硷拷锟斤拷锟酵匡拷锟斤拷锟侥硷拷锟斤拷锟斤拷锟斤拷 ';type=mimetype' 锟侥革拷式指锟斤拷锟斤拷 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟� urlencoded 锟斤拷锟斤拷址锟斤拷锟斤拷锟斤拷锟斤拷锟�'para1=val1&para2=val2&...'锟斤拷也锟斤拷锟斤拷使锟斤拷一锟斤拷锟斤拷锟街讹拷锟斤拷为锟斤拷值锟斤拷锟街讹拷锟斤拷锟斤拷为值锟斤拷锟斤拷锟介。 锟斤拷锟�value锟斤拷一锟斤拷锟斤拷锟介,Content-Type头锟斤拷锟结被锟斤拷锟矫筹拷multipart/form-data锟斤拷 锟斤拷 PHP 5.2.0 锟斤拷始锟斤拷使锟斤拷 @ 前缀锟斤拷锟斤拷锟侥硷拷时锟斤拷value 锟斤拷锟斤拷锟角革拷锟斤拷锟介。 锟斤拷 PHP 5.5.0 锟斤拷始, @ 前缀锟窖憋拷锟斤拷锟斤拷锟斤拷锟侥硷拷锟斤拷通锟斤拷 CURLFile 锟斤拷锟酵★拷 锟斤拷锟斤拷 CURLOPT_SAFE_UPLOADTRUE 锟缴斤拷锟斤拷 @ 前缀锟斤拷锟斤拷锟侥硷拷锟斤拷锟斤拷锟斤拷锟接帮拷全锟皆★拷
CURLOPT_PRIVATE Any data that should be associated with this cURL handle. This data can subsequently be retrieved with the CURLINFO_PRIVATE option of curl_getinfo(). cURL does nothing with this data. When using a cURL multi handle, this private data is typically a unique key to identify a standard cURL handle. Added in cURL 7.10.3.
CURLOPT_PROXY HTTP 锟斤拷锟斤拷通锟斤拷锟斤拷
CURLOPT_PROXY_SERVICE_NAME 锟斤拷锟斤拷锟斤拷证锟斤拷锟斤拷锟斤拷锟斤拷啤锟� cURL 7.34.0 锟斤拷锟斤拷樱锟絇HP 7.0.7 锟斤拷锟斤拷效锟斤拷
CURLOPT_PROXYUSERPWD 一锟斤拷锟斤拷锟斤拷锟斤拷锟接碉拷锟斤拷锟斤拷锟�"[username]:[password]"锟斤拷式锟斤拷锟街凤拷锟斤拷锟斤拷
CURLOPT_RANDOM_FILE 一锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷 SSL 锟斤拷锟斤拷锟斤拷锟斤拷拥锟斤拷募锟斤拷锟斤拷锟�
CURLOPT_RANGE 锟斤拷"X-Y"锟斤拷锟斤拷式锟斤拷锟斤拷锟斤拷X锟斤拷Y锟斤拷锟角匡拷选锟斤拷锟饺★拷锟斤拷莸姆锟轿э拷锟斤拷锟斤拷纸诩啤锟紿TTP锟斤拷锟斤拷锟竭筹拷也支锟街硷拷锟斤拷锟斤拷锟斤拷锟斤拷锟截革拷锟斤拷锟叫硷拷锟矫讹拷锟脚分革拷锟斤拷"X-Y,N-M"锟斤拷
CURLOPT_REFERER 锟斤拷HTTP锟斤拷锟斤拷头锟斤拷"Referer: "锟斤拷锟斤拷锟捷★拷
CURLOPT_SERVICE_NAME 锟斤拷证锟斤拷锟斤拷锟斤拷锟斤拷锟� cURL 7.43.0 锟斤拷锟斤拷樱锟斤拷锟� PHP 7.0.7 锟斤拷效锟斤拷
CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 锟斤拷锟斤拷 32 位锟斤拷锟斤拷 16 锟斤拷锟斤拷锟斤拷值锟斤拷锟斤拷锟斤拷址锟斤拷锟接︼拷锟斤拷锟皆讹拷锟斤拷锟斤拷锟斤拷锟皆匡拷锟絧ublic key锟斤拷 锟斤拷 MD5 校锟斤拷值锟斤拷锟节诧拷匹锟斤拷锟绞憋拷锟� libcurl 锟斤拷芫锟斤拷锟斤拷印锟� 锟斤拷选锟斤拷锟斤拷锟斤拷锟� SCP 锟斤拷 SFTP 锟侥达拷锟戒。 cURL 7.17.1 锟斤拷锟斤拷印锟�
CURLOPT_SSH_PUBLIC_KEYFILE The file name for your public key. If not used, libcurl defaults to $HOME/.ssh/id_dsa.pub if the HOME environment variable is set, and just "id_dsa.pub" in the current directory if HOME is not set. Added in cURL 7.16.1.
CURLOPT_SSH_PRIVATE_KEYFILE The file name for your private key. If not used, libcurl defaults to $HOME/.ssh/id_dsa if the HOME environment variable is set, and just "id_dsa" in the current directory if HOME is not set. If the file is password-protected, set the password with CURLOPT_KEYPASSWD. Added in cURL 7.16.1.
CURLOPT_SSL_CIPHER_LIST 一锟斤拷SSL锟侥硷拷锟斤拷锟姐法锟叫憋拷锟斤拷锟斤拷RC4-SHA锟斤拷TLSv1锟斤拷锟角匡拷锟矫的硷拷锟斤拷锟叫憋拷
CURLOPT_SSLCERT 一锟斤拷锟斤拷锟斤拷 PEM 锟斤拷式证锟斤拷锟斤拷募锟斤拷锟斤拷锟�
CURLOPT_SSLCERTPASSWD 使锟斤拷CURLOPT_SSLCERT证锟斤拷锟斤拷要锟斤拷锟斤拷锟诫。
CURLOPT_SSLCERTTYPE 证锟斤拷锟斤拷锟斤拷汀锟街э拷值母锟绞斤拷锟�"PEM" (默锟斤拷值), "DER"锟斤拷"ENG"锟斤拷 锟斤拷 cURL 7.9.3锟斤拷 锟斤拷锟斤拷锟诫。
CURLOPT_SSLENGINE 锟斤拷锟斤拷锟斤拷CURLOPT_SSLKEY锟斤拷指锟斤拷锟斤拷SSL私钥锟侥硷拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟�
CURLOPT_SSLENGINE_DEFAULT 锟斤拷锟斤拷锟斤拷锟角对称硷拷锟杰诧拷锟斤拷锟侥憋拷锟斤拷锟斤拷
CURLOPT_SSLKEY 锟斤拷锟斤拷 SSL 私钥锟斤拷锟侥硷拷锟斤拷锟斤拷
CURLOPT_SSLKEYPASSWD

锟斤拷 CURLOPT_SSLKEY锟斤拷指锟斤拷锟剿碉拷SSL私钥锟斤拷锟斤拷锟诫。

Note:

锟斤拷锟斤拷锟斤拷锟窖★拷锟斤拷锟斤拷锟斤拷锟斤拷锟叫碉拷锟斤拷锟斤拷锟斤拷息锟斤拷锟角得憋拷证锟斤拷锟絇HP锟脚憋拷锟侥帮拷全锟斤拷

CURLOPT_SSLKEYTYPE CURLOPT_SSLKEY锟叫规定锟斤拷私钥锟侥硷拷锟斤拷锟斤拷锟酵o拷支锟街碉拷锟斤拷钥锟斤拷锟斤拷为"PEM"(默锟斤拷值)锟斤拷"DER"锟斤拷"ENG"锟斤拷
CURLOPT_UNIX_SOCKET_PATH 使锟斤拷 Unix 锟阶斤拷锟斤拷锟斤拷为锟斤拷锟接o拷锟斤拷锟斤拷指锟斤拷锟斤拷 string 锟斤拷为路锟斤拷锟斤拷 cURL 7.40.0 锟斤拷锟斤拷樱锟� PHP 7.0.7 锟斤拷锟斤拷效锟斤拷
CURLOPT_URL 锟斤拷要锟斤拷取锟斤拷 URL 锟斤拷址锟斤拷也锟斤拷锟斤拷锟斤拷curl_init() 锟斤拷始锟斤拷锟结话锟斤拷时锟斤拷
CURLOPT_USERAGENT 锟斤拷HTTP锟斤拷锟斤拷锟叫帮拷锟斤拷一锟斤拷"User-Agent: "头锟斤拷锟街凤拷锟斤拷锟斤拷
CURLOPT_USERNAME 锟斤拷证锟斤拷使锟矫碉拷锟矫伙拷锟斤拷锟斤拷 cURL 7.19.1 锟斤拷锟斤拷樱锟絇HP 5.5.0 锟斤拷锟斤拷效锟斤拷
CURLOPT_USERPWD 锟斤拷锟斤拷一锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷要锟斤拷锟矫伙拷锟斤拷锟斤拷锟斤拷锟诫,锟斤拷式为锟斤拷"[username]:[password]"锟斤拷
CURLOPT_XOAUTH2_BEARER 指锟斤拷 OAuth 2.0 access token锟斤拷 cURL 7.33.0 锟斤拷锟斤拷樱锟斤拷锟� PHP 7.0.7 锟斤拷印锟�

锟斤拷锟斤拷option锟斤拷value应锟矫憋拷锟斤拷锟矫筹拷锟斤拷锟介:

选锟斤拷 锟斤拷选value 锟斤拷注
CURLOPT_CONNECT_TO 锟斤拷锟接碉拷指锟斤拷锟斤拷锟斤拷锟斤拷锟酵端口o拷锟芥换 URL 锟叫碉拷锟斤拷锟斤拷锟酵端口★拷锟斤拷锟斤拷指锟斤拷锟街凤拷锟斤拷锟斤拷式锟斤拷锟斤拷锟介: HOST:PORT:CONNECT-TO-HOST:CONNECT-TO-PORT锟斤拷 cURL 7.49.0 锟斤拷锟斤拷樱锟� PHP 7.0.7 锟斤拷锟斤拷效锟斤拷
CURLOPT_HTTP200ALIASES HTTP 200 锟斤拷应锟斤拷锟斤拷锟介,锟斤拷锟斤拷锟叫碉拷锟斤拷应锟诫被锟斤拷为锟斤拷锟斤拷确锟斤拷锟斤拷应锟斤拷锟斤拷锟角达拷锟斤拷 锟斤拷 cURL 7.10.3 锟叫憋拷锟斤拷锟诫。
CURLOPT_HTTPHEADER 锟斤拷锟斤拷 HTTP 头锟街段碉拷锟斤拷锟介。锟斤拷式锟斤拷 array('Content-type: text/plain', 'Content-length: 100')
CURLOPT_POSTQUOTE 锟斤拷 FTP 锟斤拷锟斤拷执锟斤拷锟斤拷珊锟斤拷诜锟斤拷锟斤拷锟斤拷锟街达拷械锟揭伙拷锟絘rray锟斤拷式锟斤拷 FTP 锟斤拷锟筋。
CURLOPT_PROXYHEADER 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷远锟斤拷锟� HTTP 头锟斤拷 cURL 7.37.0 锟斤拷锟斤拷樱锟斤拷锟� PHP 7.0.7 锟斤拷印锟�
CURLOPT_QUOTE 一锟斤拷锟斤拷锟斤拷 FTP 锟斤拷锟斤拷锟斤拷诜锟斤拷锟斤拷锟斤拷锟街达拷械锟紽TP锟斤拷锟筋。
CURLOPT_RESOLVE 锟结供锟皆讹拷锟斤拷锟街凤拷锟街革拷锟斤拷锟斤拷锟斤拷锟斤拷投丝凇锟� 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟剿口猴拷 ip 锟斤拷址锟斤拷锟街凤拷锟斤拷锟斤拷锟斤拷锟� array 锟侥o拷每锟斤拷元锟斤拷锟斤拷冒锟脚分革拷锟斤拷锟斤拷式锟斤拷 array("example.com:80:127.0.0.1") 锟斤拷 cURL 7.21.3 锟斤拷锟斤拷樱锟斤拷锟� PHP 5.5.0 锟斤拷锟斤拷谩锟�

锟斤拷锟斤拷 option锟斤拷value应锟矫憋拷锟斤拷锟矫筹拷锟斤拷锟斤拷源 锟斤拷锟斤拷锟斤拷使锟斤拷fopen()锟斤拷锟斤拷

选锟斤拷 锟斤拷选value
CURLOPT_FILE 锟斤拷锟斤拷锟斤拷锟斤拷募锟斤拷锟侥拷锟轿�STDOUT (锟斤拷锟斤拷锟�)锟斤拷
CURLOPT_INFILE 锟较达拷锟侥硷拷时锟斤拷要锟斤拷取锟斤拷锟侥硷拷锟斤拷
CURLOPT_STDERR 锟斤拷锟斤拷锟斤拷锟斤拷牡锟街凤拷锟饺★拷锟侥拷系锟�STDERR锟斤拷
CURLOPT_WRITEHEADER 锟斤拷锟斤拷 header 锟斤拷锟斤拷锟斤拷锟捷碉拷写锟斤拷锟斤拷募锟斤拷锟街凤拷锟�

锟斤拷锟斤拷option 锟斤拷 value应锟斤拷锟斤拷锟斤拷效锟侥猴拷锟斤拷锟斤拷锟竭闭帮拷锟斤拷

选锟斤拷 value
CURLOPT_HEADERFUNCTION 锟斤拷锟斤拷一锟斤拷锟截碉拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟揭伙拷锟斤拷锟絚URL锟斤拷锟斤拷源锟斤拷锟斤拷锟斤拷诙锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷 header 锟斤拷锟捷★拷header锟斤拷锟捷碉拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷写锟斤拷锟斤拷锟斤拷荽锟叫★拷锟�
CURLOPT_PASSWDFUNCTION 锟斤拷锟斤拷一锟斤拷锟截碉拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷一锟斤拷锟斤拷cURL锟斤拷锟斤拷源锟斤拷锟斤拷锟斤拷诙锟斤拷锟斤拷锟揭伙拷锟斤拷锟斤拷锟斤拷锟绞撅拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷氤わ拷锟斤拷锟斤拷锟斤拷锟斤拷锟街碉拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷值锟斤拷
CURLOPT_PROGRESSFUNCTION

锟斤拷锟斤拷一锟斤拷锟截碉拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟揭伙拷锟斤拷锟絚URL锟斤拷锟斤拷源锟斤拷锟斤拷锟斤拷诙锟斤拷锟斤拷锟皆わ拷锟揭拷锟斤拷氐锟斤拷锟斤拷纸冢锟絙ytes锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷目前锟斤拷锟截碉拷锟街斤拷锟斤拷锟斤拷锟斤拷锟侥革拷锟斤拷预锟狡达拷锟斤拷锟斤拷锟斤拷锟较达拷锟街斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟侥壳帮拷洗锟斤拷锟斤拷纸锟斤拷锟斤拷锟�

Note:

只锟斤拷锟斤拷锟斤拷 CURLOPT_NOPROGRESS 选锟斤拷为 FALSE 时锟脚伙拷锟斤拷锟斤拷锟斤拷锟截碉拷锟斤拷锟斤拷锟斤拷

锟斤拷锟截凤拷锟斤拷值锟斤拷锟叫断达拷锟戒。 锟斤拷锟戒将锟斤拷锟斤拷 CURLE_ABORTED_BY_CALLBACK 锟斤拷锟斤拷

CURLOPT_READFUNCTION 锟截碉拷锟斤拷锟斤拷锟斤拷锟斤拷锟矫猴拷锟斤拷应锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷一锟斤拷锟斤拷 cURL resource锟斤拷锟节讹拷锟斤拷锟斤拷通锟斤拷选锟斤拷 CURLOPT_INFILE 锟斤拷锟斤拷 cURL 锟斤拷 stream resource锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟皆讹拷取锟斤拷锟斤拷锟捷碉拷锟斤拷锟斤拷锟斤拷锟斤拷 锟斤拷锟斤拷锟斤拷锟斤拷锟诫返锟斤拷一锟斤拷锟街凤拷锟斤拷锟斤拷锟斤拷锟斤拷小锟节伙拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷一锟斤拷哟锟斤拷锟斤拷 stream resource 锟斤拷取锟斤拷锟斤拷锟截匡拷锟街凤拷锟斤拷锟斤拷为 EOF锟斤拷锟侥硷拷锟斤拷锟斤拷锟斤拷 锟脚号★拷
CURLOPT_WRITEFUNCTION 锟截碉拷锟斤拷锟斤拷锟斤拷锟斤拷锟矫猴拷锟斤拷应锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷一锟斤拷锟斤拷 cURL resource锟斤拷锟节讹拷锟斤拷锟斤拷要写锟斤拷锟斤拷锟斤拷锟斤拷址锟斤拷锟斤拷锟斤拷锟� 锟捷憋拷锟斤拷锟节猴拷锟斤拷锟叫憋拷锟斤拷锟芥。 锟斤拷锟斤拷锟斤拷锟斤拷准确锟斤拷锟斤拷写锟斤拷锟斤拷锟捷碉拷锟街斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷岜灰伙拷锟斤拷锟斤拷锟斤拷锟斤拷锟� 锟较★拷

锟斤拷锟斤拷值锟斤拷

Option 锟斤拷锟斤拷 value
CURLOPT_SHARE curl_share_init() 锟斤拷锟截的斤拷锟斤拷锟� 使 cURL 锟斤拷锟皆达拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷荨锟�

锟斤拷锟斤拷值

锟缴癸拷时锟斤拷锟斤拷 TRUE锟斤拷 锟斤拷锟斤拷锟斤拷失锟斤拷时锟斤拷锟斤拷 FALSE锟斤拷

锟斤拷锟斤拷锟斤拷志

锟芥本 说锟斤拷
7.0.7 锟斤拷锟斤拷 CURL_HTTP_VERSION_2锟斤拷 CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE锟斤拷 CURL_HTTP_VERSION_2TLS锟斤拷 CURL_REDIR_POST_301锟斤拷 CURL_REDIR_POST_302锟斤拷 CURL_REDIR_POST_303锟斤拷 CURL_REDIR_POST_ALL锟斤拷 CURL_VERSION_KERBEROS5锟斤拷 CURL_VERSION_PSL锟斤拷 CURL_VERSION_UNIX_SOCKETS锟斤拷 CURLAUTH_NEGOTIATE锟斤拷 CURLAUTH_NTLM_WB锟斤拷 CURLFTP_CREATE_DIR锟斤拷 CURLFTP_CREATE_DIR_NONE锟斤拷 CURLFTP_CREATE_DIR_RETRY锟斤拷 CURLHEADER_SEPARATE锟斤拷 CURLHEADER_UNIFIED锟斤拷 CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE锟斤拷 CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE锟斤拷 CURLMOPT_MAX_HOST_CONNECTIONS锟斤拷 CURLMOPT_MAX_PIPELINE_LENGTH锟斤拷 CURLMOPT_MAX_TOTAL_CONNECTIONS锟斤拷 CURLOPT_CONNECT_TO锟斤拷 CURLOPT_DEFAULT_PROTOCOL锟斤拷 CURLOPT_DNS_INTERFACE锟斤拷 CURLOPT_DNS_LOCAL_IP4锟斤拷 CURLOPT_DNS_LOCAL_IP6锟斤拷 CURLOPT_EXPECT_100_TIMEOUT_MS锟斤拷 CURLOPT_HEADEROPT锟斤拷 CURLOPT_LOGIN_OPTIONS锟斤拷 CURLOPT_PATH_AS_IS锟斤拷 CURLOPT_PINNEDPUBLICKEY锟斤拷 CURLOPT_PIPEWAIT锟斤拷 CURLOPT_PROXY_SERVICE_NAME锟斤拷 CURLOPT_PROXYHEADER锟斤拷 CURLOPT_SASL_IR锟斤拷 CURLOPT_SERVICE_NAME锟斤拷 CURLOPT_SSL_ENABLE_ALPN锟斤拷 CURLOPT_SSL_ENABLE_NPN锟斤拷 CURLOPT_SSL_FALSESTART锟斤拷 CURLOPT_SSL_VERIFYSTATUS锟斤拷 CURLOPT_STREAM_WEIGHT锟斤拷 CURLOPT_TCP_FASTOPEN锟斤拷 CURLOPT_TFTP_NO_OPTIONS锟斤拷 CURLOPT_UNIX_SOCKET_PATH锟斤拷 CURLOPT_XOAUTH2_BEARER锟斤拷 CURLPROTO_SMB锟斤拷 CURLPROTO_SMBS锟斤拷 CURLPROXY_HTTP_1_0锟斤拷 CURLSSH_AUTH_AGENT 锟斤拷 CURLSSLOPT_NO_REVOKE锟斤拷
7.0.0 锟斤拷锟斤拷 CURLOPT_SAFE_UPLOAD 锟斤拷选锟斤拷锟窖憋拷删锟斤拷锟剿★拷 锟斤拷锟叫碉拷 curl 锟侥硷拷锟斤拷锟较达拷锟斤拷锟斤拷锟斤拷使锟斤拷 CURLFile锟斤拷
5.6.0 默锟斤拷 CURLOPT_SAFE_UPLOADTRUE 锟斤拷
5.6.0 锟狡筹拷 CURLOPT_CLOSEPOLICY锟斤拷锟斤拷氐锟街碉拷锟�
5.5.0 锟斤拷锟� cURL 锟斤拷源锟斤拷为 CURLOPT_PROGRESSFUNCTION 锟截碉拷锟斤拷锟斤拷锟侥碉拷一锟斤拷锟斤拷锟斤拷锟斤拷
5.5.0 锟斤拷锟斤拷 CURLOPT_SHARE锟斤拷
5.3.0 锟斤拷锟斤拷 CURLOPT_PROGRESSFUNCTION锟斤拷
5.2.10 锟斤拷锟斤拷 CURLOPT_PROTOCOLS, and CURLOPT_REDIR_PROTOCOLS.
5.2.4 锟斤拷锟斤拷锟斤拷 CURLOPT_PRIVATE锟斤拷
5.1.0 锟斤拷锟斤拷 CURLOPT_AUTOREFERER, CURLOPT_BINARYTRANSFER, CURLOPT_FTPSSLAUTH, CURLOPT_PROXYAUTH, and CURLOPT_TIMECONDITION.
5.0.0 锟斤拷锟斤拷 CURLOPT_FTP_USE_EPRT, CURLOPT_NOSIGNAL, CURLOPT_UNRESTRICTED_AUTH, CURLOPT_BUFFERSIZE, CURLOPT_HTTPAUTH, CURLOPT_PROXYPORT, CURLOPT_PROXYTYPE, CURLOPT_SSLCERTTYPE, and CURLOPT_HTTP200ALIASES.

锟斤拷锟斤拷

Example #1 锟斤拷始锟斤拷一锟斤拷锟铰碉拷cURL锟结话锟斤拷锟斤拷取一锟斤拷锟斤拷页

<?php
// 锟斤拷锟斤拷一锟斤拷锟斤拷cURL锟斤拷源
$ch curl_init();

// 锟斤拷锟斤拷URL锟斤拷锟斤拷应锟斤拷选锟斤拷
curl_setopt($chCURLOPT_URL"http://www.example.com/");
curl_setopt($chCURLOPT_HEADERfalse);

// 抓取URL锟斤拷锟斤拷锟斤拷锟斤拷锟捷革拷锟斤拷锟斤拷锟�
curl_exec($ch);

//锟截憋拷cURL锟斤拷源锟斤拷锟斤拷锟斤拷锟酵凤拷系统锟斤拷源
curl_close($ch);
?>

Example #2 锟较达拷锟侥硷拷 (PHP 5.5.0 锟襟被凤拷锟斤拷)

<?php

/* http://localhost/upload.php:
print_r($_POST);
print_r($_FILES);
*/

$ch curl_init();

$data = array('name' => 'Foo''file' => '@/home/user/test.png');

curl_setopt($chCURLOPT_URL'http://localhost/upload.php');
curl_setopt($chCURLOPT_POST1);
curl_setopt($chCURLOPT_SAFE_UPLOADfalse); //  PHP 5.6.0 锟斤拷锟斤拷肟拷锟�
curl_setopt($chCURLOPT_POSTFIELDS$data);

curl_exec($ch);
?>

锟斤拷锟斤拷锟斤拷锟教伙拷锟斤拷锟斤拷锟�

Array
(
    [name] => Foo
)
Array
(
    [file] => Array
        (
            [name] => test.png
            [type] => image/png
            [tmp_name] => /tmp/phpcpjNeQ
            [error] => 0
            [size] => 279
        )

)

注锟斤拷

Note:

锟斤拷锟斤拷一锟斤拷锟斤拷锟介到CURLOPT_POSTFIELDS锟斤拷cURL锟斤拷锟斤拷锟斤拷荼锟斤拷锟斤拷 multipart/form-data锟斤拷锟斤拷然锟斤拷锟斤拷一锟斤拷URL-encoded锟街凤拷锟斤拷时锟斤拷锟斤拷锟捷会被锟斤拷锟斤拷锟� application/x-www-form-urlencoded锟斤拷

锟轿硷拷

  • curl_setopt_array() - 为 cURL 锟斤拷锟斤拷峄帮拷锟斤拷锟斤拷锟斤拷锟窖★拷锟�