由于该函数有大量选项,因此给出官网链接以便查阅理解curl_easy_setopt
相关:
easy options
多选项
API
curl_easy_setopt - 设置curl easy handle的选项
#include
CURLcode curl_easy_setopt(CURL * handle,CURLoption选项,参数);
curl_easy_setopt用于告诉libcurl如何表现。通过设置适当的选项,应用程序可以更改libcurl的行为。所有选项均使用选项后跟参数进行设置。该参数可以是long,函数指针,对象指针或curl_off_t,具体取决于特定选项所期望的内容。请仔细阅读本手册,因为错误的输入值可能导致libcurl表现不佳!您只能在每个函数调用中设置一个选项。典型应用程序在设置阶段使用许多curl_easy_setopt调用。
使用此函数调用设置的选项对使用此句柄执行的所有即将进行的传输有效。传输之间不会以任何方式重置选项,因此如果您希望使用不同选项进行后续传输,则必须在传输之间进行更改。您可以选择使用curl_easy_reset将所有选项重置为内部默认值。
传递给libcurl的字符串作为'char *'参数,由库复制; 因此,curl_easy_setopt返回后,可能会覆盖与指针参数关联的字符串存储。此规则的唯一例外是CURLOPT_POSTFIELDS,但复制字符串CURLOPT_COPYPOSTFIELDS的替代方案具有您需要阅读的一些使用特性。
设置选项的顺序无关紧要。
在版本7.17.0之前,不会复制字符串。相反,用户被强制保持可用,直到libcurl不再需要它们。
该手柄是从返回代码curl_easy_init或curl_easy_duphandle电话。
CURLOPT_VERBOSE
显示详细信息。请参阅CURLOPT_VERBOSE
CURLOPT_HEADER
在正文输出中包含标题。请参阅CURLOPT_HEADER
CURLOPT_NOPROGRESS
关闭进度表。请参阅CURLOPT_NOPROGRESS
CURLOPT_NOSIGNAL
不要安装信号处理程序。请参阅CURLOPT_NOSIGNAL
CURLOPT_WILDCARDMATCH
根据文件名模式传输多个文件。请参阅CURLOPT_WILDCARDMATCH
CURLOPT_WRITEFUNCTION
回写写入数据。请参阅CURLOPT_WRITEFUNCTION
CURLOPT_WRITEDATA
传递给写回调的数据指针。见CURLOPT_WRITEDATA
CURLOPT_READFUNCTION
回调读取数据。请参见CURLOPT_READFUNCTION
CURLOPT_READDATA
传递给read回调的数据指针。请参阅CURLOPT_READDATA
CURLOPT_IOCTLFUNCTION
回调I / O操作。请参阅CURLOPT_IOCTLFUNCTION
CURLOPT_IOCTLDATA
传递给I / O回调的数据指针。见CURLOPT_IOCTLDATA
CURLOPT_SEEKFUNCTION
寻求操作的回调。请参阅CURLOPT_SEEKFUNCTION
CURLOPT_SEEKDATA
传递给搜索回调的数据指针。见CURLOPT_SEEKDATA
CURLOPT_SOCKOPTFUNCTION
回调sockopt操作。请参阅CURLOPT_SOCKOPTFUNCTION
CURLOPT_SOCKOPTDATA
传递给sockopt回调的数据指针。见CURLOPT_SOCKOPTDATA
CURLOPT_OPENSOCKETFUNCTION
回调套接字创建。请参见CURLOPT_OPENSOCKETFUNCTION
CURLOPT_OPENSOCKETDATA
数据指针传递给打开的套接字回调。请参见CURLOPT_OPENSOCKETDATA
CURLOPT_CLOSESOCKETFUNCTION
关闭套接字的回调。请参阅CURLOPT_CLOSESOCKETFUNCTION
CURLOPT_CLOSESOCKETDATA
传递给关闭套接字回调的数据指针。请参阅CURLOPT_CLOSESOCKETDATA
CURLOPT_PROGRESSFUNCTION
OBSOLETE进度表的回调。请参阅CURLOPT_PROGRESSFUNCTION
CURLOPT_PROGRESSDATA
传递给进度表回调的数据指针。请参阅CURLOPT_PROGRESSDATA
CURLOPT_XFERINFOFUNCTION
回调进度表。请参见CURLOPT_XFERINFOFUNCTION
CURLOPT_XFERINFODATA
传递给进度表回调的数据指针。请参见CURLOPT_XFERINFODATA
CURLOPT_HEADERFUNCTION
回写写入收到的标题。请参阅CURLOPT_HEADERFUNCTION
CURLOPT_HEADERDATA
传递给标头回调的数据指针。请参阅CURLOPT_HEADERDATA
CURLOPT_DEBUGFUNCTION
回调调试信息。请参阅CURLOPT_DEBUGFUNCTION
CURLOPT_DEBUGDATA
传递给调试回调的数据指针。请参阅CURLOPT_DEBUGDATA
CURLOPT_SSL_CTX_FUNCTION
回调SSL上下文逻辑。请参见CURLOPT_SSL_CTX_FUNCTION
CURLOPT_SSL_CTX_DATA
传递给SSL上下文回调的数据指针。请参见CURLOPT_SSL_CTX_DATA
CURLOPT_CONV_TO_NETWORK_FUNCTION
回调代码库转换。请参见CURLOPT_CONV_TO_NETWORK_FUNCTION
CURLOPT_CONV_FROM_NETWORK_FUNCTION
回调代码库转换。请参见CURLOPT_CONV_FROM_NETWORK_FUNCTION
CURLOPT_CONV_FROM_UTF8_FUNCTION
回调代码库转换。请参见CURLOPT_CONV_FROM_UTF8_FUNCTION
CURLOPT_INTERLEAVEFUNCTION
回调RTSP交错数据。请参阅CURLOPT_INTERLEAVEFUNCTION
CURLOPT_INTERLEAVEDATA
传递给RTSP交错回调的数据指针。请参阅CURLOPT_INTERLEAVEDATA
CURLOPT_CHUNK_BGN_FUNCTION
回调通配符下载块的开始。请参阅CURLOPT_CHUNK_BGN_FUNCTION
CURLOPT_CHUNK_END_FUNCTION
回调通配符下载结束块。请参阅CURLOPT_CHUNK_END_FUNCTION
CURLOPT_CHUNK_DATA
传递给块回调的数据指针。请参阅CURLOPT_CHUNK_DATA
CURLOPT_FNMATCH_FUNCTION
回调通配符匹配。请参见CURLOPT_FNMATCH_FUNCTION
CURLOPT_FNMATCH_DATA
传递给通配符匹配回调的数据指针。请参阅CURLOPT_FNMATCH_DATA
CURLOPT_SUPPRESS_CONNECT_HEADERS
从用户回调中抑制代理CONNECT响应头。请参阅CURLOPT_SUPPRESS_CONNECT_HEADERS
CURLOPT_RESOLVER_START_FUNCTION
在启动新的解析请求之前调用回调。请参见CURLOPT_RESOLVER_START_FUNCTION
CURLOPT_RESOLVER_START_DATA
传递给解析器的数据指针开始回调。请参见CURLOPT_RESOLVER_START_DATA
CURLOPT_ERRORBUFFER
错误消息缓冲区。请参阅CURLOPT_ERRORBUFFER
CURLOPT_STDERR
stderr替换流。见CURLOPT_STDERR
CURLOPT_FAILONERROR
HTTP 4xx错误失败。CURLOPT_FAILONERROR
CURLOPT_KEEP_SENDING_ON_ERROR
继续发送HTTP> = 300错误。CURLOPT_KEEP_SENDING_ON_ERROR
CURLOPT_URL
要处理的URL。请参阅CURLOPT_URL
CURLOPT_PATH_AS_IS
禁用路径中的压缩/../和/./序列。请参见CURLOPT_PATH_AS_IS
CURLOPT_PROTOCOLS
允许的协议。请参阅CURLOPT_PROTOCOLS
CURLOPT_REDIR_PROTOCOLS
允许重定向到的协议。请参阅CURLOPT_REDIR_PROTOCOLS
CURLOPT_DEFAULT_PROTOCOL
默认协议。请参见CURLOPT_DEFAULT_PROTOCOL
CURLOPT_PROXY
要使用的代理。请参阅CURLOPT_PROXY
CURLOPT_PRE_PROXY
袜子代理使用。请参阅CURLOPT_PRE_PROXY
CURLOPT_PROXYPORT
要使用的代理端口。见CURLOPT_PROXYPORT
CURLOPT_PROXYTYPE
代理类型。请参见CURLOPT_PROXYTYPE
CURLOPT_NOPROXY
从代理使用中筛选出主机。CURLOPT_NOPROXY
CURLOPT_HTTPPROXYTUNNEL
通过HTTP代理隧道。CURLOPT_HTTPPROXYTUNNEL
CURLOPT_CONNECT_TO
连接到特定主机和端口。请参阅CURLOPT_CONNECT_TO
CURLOPT_SOCKS5_AUTH
Socks5身份验证方法。请参阅CURLOPT_SOCKS5_AUTH
CURLOPT_SOCKS5_GSSAPI_SERVICE
Socks5 GSSAPI服务名称。CURLOPT_SOCKS5_GSSAPI_SERVICE
CURLOPT_SOCKS5_GSSAPI_NEC
Socks5 GSSAPI NEC模式。请参阅CURLOPT_SOCKS5_GSSAPI_NEC
CURLOPT_PROXY_SERVICE_NAME
代理验证服务名称。CURLOPT_PROXY_SERVICE_NAME
CURLOPT_HAPROXYPROTOCOL
发送HAProxy PROXY协议v1标头。请参阅CURLOPT_HAPROXYPROTOCOL
CURLOPT_SERVICE_NAME
验证服务名称。CURLOPT_SERVICE_NAME
CURLOPT_INTERFACE
将连接本地绑定到此。请参阅CURLOPT_INTERFACE
CURLOPT_LOCALPORT
将连接本地绑定到此端口。请参阅CURLOPT_LOCALPORT
CURLOPT_LOCALPORTRANGE
将连接本地绑定到端口范围。请参阅CURLOPT_LOCALPORTRANGE
CURLOPT_DNS_CACHE_TIMEOUT
DNS缓存超时。请参见CURLOPT_DNS_CACHE_TIMEOUT
CURLOPT_DNS_USE_GLOBAL_CACHE
OBSOLETE启用全局DNS缓存。请参阅CURLOPT_DNS_USE_GLOBAL_CACHE
CURLOPT_DOH_URL
使用此DOH服务器进行名称解析。请参阅CURLOPT_DOH_URL
CURLOPT_BUFFERSIZE
要求备用缓冲区大小。请参阅CURLOPT_BUFFERSIZE
CURLOPT_PORT
要连接的端口号。请参见CURLOPT_PORT
CURLOPT_TCP_FASTOPEN
启用TFO,TCP快速打开。见CURLOPT_TCP_FASTOPEN
CURLOPT_TCP_NODELAY
禁用Nagle算法。请参阅CURLOPT_TCP_NODELAY
CURLOPT_ADDRESS_SCOPE
本地地址的IPv6范围。请参阅CURLOPT_ADDRESS_SCOPE
CURLOPT_TCP_KEEPALIVE
启用TCP keep-alive。请参阅CURLOPT_TCP_KEEPALIVE
CURLOPT_TCP_KEEPIDLE
Idle time before sending keep-alive. See CURLOPT_TCP_KEEPIDLE
CURLOPT_TCP_KEEPINTVL
Interval between keep-alive probes. See CURLOPT_TCP_KEEPINTVL
CURLOPT_UNIX_SOCKET_PATH
Path to a Unix domain socket. See CURLOPT_UNIX_SOCKET_PATH
CURLOPT_ABSTRACT_UNIX_SOCKET
Path to an abstract Unix domain socket. See CURLOPT_ABSTRACT_UNIX_SOCKET
CURLOPT_NETRC
Enable .netrc parsing. See CURLOPT_NETRC
CURLOPT_NETRC_FILE
.netrc file name. See CURLOPT_NETRC_FILE
CURLOPT_USERPWD
User name and password. See CURLOPT_USERPWD
CURLOPT_PROXYUSERPWD
Proxy user name and password. See CURLOPT_PROXYUSERPWD
CURLOPT_USERNAME
User name. See CURLOPT_USERNAME
CURLOPT_PASSWORD
Password. See CURLOPT_PASSWORD
CURLOPT_LOGIN_OPTIONS
Login options. See CURLOPT_LOGIN_OPTIONS
CURLOPT_PROXYUSERNAME
Proxy user name. See CURLOPT_PROXYUSERNAME
CURLOPT_PROXYPASSWORD
Proxy password. See CURLOPT_PROXYPASSWORD
CURLOPT_HTTPAUTH
HTTP server authentication methods. See CURLOPT_HTTPAUTH
CURLOPT_TLSAUTH_USERNAME
TLS authentication user name. See CURLOPT_TLSAUTH_USERNAME
CURLOPT_PROXY_TLSAUTH_USERNAME
Proxy TLS authentication user name. See CURLOPT_PROXY_TLSAUTH_USERNAME
CURLOPT_TLSAUTH_PASSWORD
TLS authentication password. See CURLOPT_TLSAUTH_PASSWORD
CURLOPT_PROXY_TLSAUTH_PASSWORD
Proxy TLS authentication password. See CURLOPT_PROXY_TLSAUTH_PASSWORD
CURLOPT_TLSAUTH_TYPE
TLS authentication methods. See CURLOPT_TLSAUTH_TYPE
CURLOPT_PROXY_TLSAUTH_TYPE
Proxy TLS authentication methods. See CURLOPT_PROXY_TLSAUTH_TYPE
CURLOPT_PROXYAUTH
HTTP proxy authentication methods. See CURLOPT_PROXYAUTH
CURLOPT_SASL_IR
Enable SASL initial response. See CURLOPT_SASL_IR
CURLOPT_XOAUTH2_BEARER
OAuth2 bearer token. See CURLOPT_XOAUTH2_BEARER
CURLOPT_DISALLOW_USERNAME_IN_URL
Don't allow username in URL. See CURLOPT_DISALLOW_USERNAME_IN_URL
CURLOPT_AUTOREFERER
Automatically set Referer: header. See CURLOPT_AUTOREFERER
CURLOPT_ACCEPT_ENCODING
Accept-Encoding and automatic decompressing data. See CURLOPT_ACCEPT_ENCODING
CURLOPT_TRANSFER_ENCODING
Request Transfer-Encoding. See CURLOPT_TRANSFER_ENCODING
CURLOPT_FOLLOWLOCATION
Follow HTTP redirects. See CURLOPT_FOLLOWLOCATION
CURLOPT_UNRESTRICTED_AUTH
Do not restrict authentication to original host. CURLOPT_UNRESTRICTED_AUTH
CURLOPT_MAXREDIRS
Maximum number of redirects to follow. See CURLOPT_MAXREDIRS
CURLOPT_POSTREDIR
How to act on redirects after POST. See CURLOPT_POSTREDIR
CURLOPT_PUT
Issue an HTTP PUT request. See CURLOPT_PUT
CURLOPT_POST
Issue an HTTP POST request. See CURLOPT_POST
CURLOPT_POSTFIELDS
Send a POST with this data. See CURLOPT_POSTFIELDS
CURLOPT_POSTFIELDSIZE
The POST data is this big. See CURLOPT_POSTFIELDSIZE
CURLOPT_POSTFIELDSIZE_LARGE
The POST data is this big. See CURLOPT_POSTFIELDSIZE_LARGE
CURLOPT_COPYPOSTFIELDS
Send a POST with this data - and copy it. See CURLOPT_COPYPOSTFIELDS
CURLOPT_HTTPPOST
Multipart formpost HTTP POST. See CURLOPT_HTTPPOST
CURLOPT_REFERER
Referer: header. See CURLOPT_REFERER
CURLOPT_USERAGENT
User-Agent: header. See CURLOPT_USERAGENT
CURLOPT_HTTPHEADER
Custom HTTP headers. See CURLOPT_HTTPHEADER
CURLOPT_HEADEROPT
Control custom headers. See CURLOPT_HEADEROPT
CURLOPT_PROXYHEADER
Custom HTTP headers sent to proxy. See CURLOPT_PROXYHEADER
CURLOPT_HTTP200ALIASES
Alternative versions of 200 OK. See CURLOPT_HTTP200ALIASES
CURLOPT_COOKIE
Cookie(s) to send. See CURLOPT_COOKIE
CURLOPT_COOKIEFILE
File to read cookies from. See CURLOPT_COOKIEFILE
CURLOPT_COOKIEJAR
File to write cookies to. See CURLOPT_COOKIEJAR
CURLOPT_COOKIESESSION
Start a new cookie session. See CURLOPT_COOKIESESSION
CURLOPT_COOKIELIST
Add or control cookies. See CURLOPT_COOKIELIST
CURLOPT_HTTPGET
Do an HTTP GET request. See CURLOPT_HTTPGET
CURLOPT_REQUEST_TARGET
Set the request target. CURLOPT_REQUEST_TARGET
CURLOPT_HTTP_VERSION
HTTP version to use. CURLOPT_HTTP_VERSION
CURLOPT_IGNORE_CONTENT_LENGTH
Ignore Content-Length. See CURLOPT_IGNORE_CONTENT_LENGTH
CURLOPT_HTTP_CONTENT_DECODING
Disable Content decoding. See CURLOPT_HTTP_CONTENT_DECODING
CURLOPT_HTTP_TRANSFER_DECODING
Disable Transfer decoding. See CURLOPT_HTTP_TRANSFER_DECODING
CURLOPT_EXPECT_100_TIMEOUT_MS
100-continue timeout. See CURLOPT_EXPECT_100_TIMEOUT_MS
CURLOPT_PIPEWAIT
Wait on connection to pipeline on it. See CURLOPT_PIPEWAIT
CURLOPT_STREAM_DEPENDS
This HTTP/2 stream depends on another. See CURLOPT_STREAM_DEPENDS
CURLOPT_STREAM_DEPENDS_E
This HTTP/2 stream depends on another exclusively. See CURLOPT_STREAM_DEPENDS_E
CURLOPT_STREAM_WEIGHT
Set this HTTP/2 stream's weight. See CURLOPT_STREAM_WEIGHT
CURLOPT_MAIL_FROM
Address of the sender. See CURLOPT_MAIL_FROM
CURLOPT_MAIL_RCPT
Address of the recipients. See CURLOPT_MAIL_RCPT
CURLOPT_MAIL_AUTH
Authentication address. See CURLOPT_MAIL_AUTH
CURLOPT_TFTP_BLKSIZE
TFTP block size. See CURLOPT_TFTP_BLKSIZE
CURLOPT_TFTP_NO_OPTIONS
Do not send TFTP options requests. See CURLOPT_TFTP_NO_OPTIONS
CURLOPT_FTPPORT
Use active FTP. See CURLOPT_FTPPORT
CURLOPT_QUOTE
Commands to run before transfer. See CURLOPT_QUOTE
CURLOPT_POSTQUOTE
Commands to run after transfer. See CURLOPT_POSTQUOTE
CURLOPT_PREQUOTE
Commands to run just before transfer. See CURLOPT_PREQUOTE
CURLOPT_APPEND
Append to remote file. See CURLOPT_APPEND
CURLOPT_FTP_USE_EPRT
Use EPTR. See CURLOPT_FTP_USE_EPRT
CURLOPT_FTP_USE_EPSV
Use EPSV. See CURLOPT_FTP_USE_EPSV
CURLOPT_FTP_USE_PRET
Use PRET. See CURLOPT_FTP_USE_PRET
CURLOPT_FTP_CREATE_MISSING_DIRS
Create missing directories on the remote server. See CURLOPT_FTP_CREATE_MISSING_DIRS
CURLOPT_FTP_RESPONSE_TIMEOUT
Timeout for FTP responses. See CURLOPT_FTP_RESPONSE_TIMEOUT
CURLOPT_FTP_ALTERNATIVE_TO_USER
Alternative to USER. See CURLOPT_FTP_ALTERNATIVE_TO_USER
CURLOPT_FTP_SKIP_PASV_IP
Ignore the IP address in the PASV response. See CURLOPT_FTP_SKIP_PASV_IP
CURLOPT_FTPSSLAUTH
Control how to do TLS. See CURLOPT_FTPSSLAUTH
CURLOPT_FTP_SSL_CCC
Back to non-TLS again after authentication. See CURLOPT_FTP_SSL_CCC
CURLOPT_FTP_ACCOUNT
Send ACCT command. See CURLOPT_FTP_ACCOUNT
CURLOPT_FTP_FILEMETHOD
Specify how to reach files. See CURLOPT_FTP_FILEMETHOD
CURLOPT_RTSP_REQUEST
RTSP request. See CURLOPT_RTSP_REQUEST
CURLOPT_RTSP_SESSION_ID
RTSP session-id. See CURLOPT_RTSP_SESSION_ID
CURLOPT_RTSP_STREAM_URI
RTSP stream URI. See CURLOPT_RTSP_STREAM_URI
CURLOPT_RTSP_TRANSPORT
RTSP Transport: header. See CURLOPT_RTSP_TRANSPORT
CURLOPT_RTSP_CLIENT_CSEQ
Client CSEQ number. See CURLOPT_RTSP_CLIENT_CSEQ
CURLOPT_RTSP_SERVER_CSEQ
CSEQ number for RTSP Server->Client request. See CURLOPT_RTSP_SERVER_CSEQ
CURLOPT_TRANSFERTEXT
Use text transfer. See CURLOPT_TRANSFERTEXT
CURLOPT_PROXY_TRANSFER_MODE
Add transfer mode to URL over proxy. See CURLOPT_PROXY_TRANSFER_MODE
CURLOPT_CRLF
Convert newlines. See CURLOPT_CRLF
CURLOPT_RANGE
Range requests. See CURLOPT_RANGE
CURLOPT_RESUME_FROM
Resume a transfer. See CURLOPT_RESUME_FROM
CURLOPT_RESUME_FROM_LARGE
Resume a transfer. See CURLOPT_RESUME_FROM_LARGE
CURLOPT_CUSTOMREQUEST
Custom request/method. See CURLOPT_CUSTOMREQUEST
CURLOPT_FILETIME
Request file modification date and time. See CURLOPT_FILETIME
CURLOPT_DIRLISTONLY
List only. See CURLOPT_DIRLISTONLY
CURLOPT_NOBODY
Do not get the body contents. See CURLOPT_NOBODY
CURLOPT_INFILESIZE
Size of file to send. CURLOPT_INFILESIZE
CURLOPT_INFILESIZE_LARGE
Size of file to send. CURLOPT_INFILESIZE_LARGE
CURLOPT_UPLOAD
Upload data. See CURLOPT_UPLOAD
CURLOPT_UPLOAD_BUFFERSIZE
Set upload buffer size. See CURLOPT_UPLOAD_BUFFERSIZE
CURLOPT_MIMEPOST
Post/send MIME data. See CURLOPT_MIMEPOST
CURLOPT_MAXFILESIZE
Maximum file size to get. See CURLOPT_MAXFILESIZE
CURLOPT_MAXFILESIZE_LARGE
Maximum file size to get. See CURLOPT_MAXFILESIZE_LARGE
CURLOPT_TIMECONDITION
Make a time conditional request. See CURLOPT_TIMECONDITION
CURLOPT_TIMEVALUE
Time value for the time conditional request. See CURLOPT_TIMEVALUE
CURLOPT_TIMEVALUE_LARGE
Time value for the time conditional request. See CURLOPT_TIMEVALUE_LARGE
CURLOPT_TIMEOUT
Timeout for the entire request. See CURLOPT_TIMEOUT
CURLOPT_TIMEOUT_MS
Millisecond timeout for the entire request. See CURLOPT_TIMEOUT_MS
CURLOPT_LOW_SPEED_LIMIT
Low speed limit to abort transfer. See CURLOPT_LOW_SPEED_LIMIT
CURLOPT_LOW_SPEED_TIME
Time to be below the speed to trigger low speed abort. See CURLOPT_LOW_SPEED_TIME
CURLOPT_MAX_SEND_SPEED_LARGE
Cap the upload speed to this. See CURLOPT_MAX_SEND_SPEED_LARGE
CURLOPT_MAX_RECV_SPEED_LARGE
Cap the download speed to this. See CURLOPT_MAX_RECV_SPEED_LARGE
CURLOPT_MAXCONNECTS
Maximum number of connections in the connection pool. See CURLOPT_MAXCONNECTS
CURLOPT_FRESH_CONNECT
Use a new connection. CURLOPT_FRESH_CONNECT
CURLOPT_FORBID_REUSE
Prevent subsequent connections from re-using this. See CURLOPT_FORBID_REUSE
CURLOPT_CONNECTTIMEOUT
Timeout for the connection phase. See CURLOPT_CONNECTTIMEOUT
CURLOPT_CONNECTTIMEOUT_MS
Millisecond timeout for the connection phase. See CURLOPT_CONNECTTIMEOUT_MS
CURLOPT_IPRESOLVE
IP version to resolve to. See CURLOPT_IPRESOLVE
CURLOPT_CONNECT_ONLY
Only connect, nothing else. See CURLOPT_CONNECT_ONLY
CURLOPT_USE_SSL
Use TLS/SSL. See CURLOPT_USE_SSL
CURLOPT_RESOLVE
Provide fixed/fake name resolves. See CURLOPT_RESOLVE
CURLOPT_DNS_INTERFACE
Bind name resolves to this interface. See CURLOPT_DNS_INTERFACE
CURLOPT_DNS_LOCAL_IP4
Bind name resolves to this IP4 address. See CURLOPT_DNS_LOCAL_IP4
CURLOPT_DNS_LOCAL_IP6
Bind name resolves to this IP6 address. See CURLOPT_DNS_LOCAL_IP6
CURLOPT_DNS_SERVERS
Preferred DNS servers. See CURLOPT_DNS_SERVERS
CURLOPT_DNS_SHUFFLE_ADDRESSES
Shuffle addresses before use. See CURLOPT_DNS_SHUFFLE_ADDRESSES
CURLOPT_ACCEPTTIMEOUT_MS
Timeout for waiting for the server's connect back to be accepted. See CURLOPT_ACCEPTTIMEOUT_MS
CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS
Timeout for happy eyeballs. See CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS
CURLOPT_UPKEEP_INTERVAL_MS
Sets the interval at which connection upkeep are performed. See CURLOPT_UPKEEP_INTERVAL_MS
CURLOPT_SSLCERT
Client cert. See CURLOPT_SSLCERT
CURLOPT_PROXY_SSLCERT
Proxy client cert. See CURLOPT_PROXY_SSLCERT
CURLOPT_SSLCERTTYPE
Client cert type. See CURLOPT_SSLCERTTYPE
CURLOPT_PROXY_SSLCERTTYPE
Proxy client cert type. See CURLOPT_PROXY_SSLCERTTYPE
CURLOPT_SSLKEY
Client key. See CURLOPT_SSLKEY
CURLOPT_PROXY_SSLKEY
Proxy client key. See CURLOPT_PROXY_SSLKEY
CURLOPT_SSLKEYTYPE
Client key type. See CURLOPT_SSLKEYTYPE
CURLOPT_PROXY_SSLKEYTYPE
Proxy client key type. See CURLOPT_PROXY_SSLKEYTYPE
CURLOPT_KEYPASSWD
Client key password. See CURLOPT_KEYPASSWD
CURLOPT_PROXY_KEYPASSWD
Proxy client key password. See CURLOPT_PROXY_KEYPASSWD
CURLOPT_SSL_ENABLE_ALPN
Enable use of ALPN. See CURLOPT_SSL_ENABLE_ALPN
CURLOPT_SSL_ENABLE_NPN
Enable use of NPN. See CURLOPT_SSL_ENABLE_NPN
CURLOPT_SSLENGINE
Use identifier with SSL engine. See CURLOPT_SSLENGINE
CURLOPT_SSLENGINE_DEFAULT
Default SSL engine. See CURLOPT_SSLENGINE_DEFAULT
CURLOPT_SSL_FALSESTART
Enable TLS False Start. See CURLOPT_SSL_FALSESTART
CURLOPT_SSLVERSION
SSL version to use. See CURLOPT_SSLVERSION
CURLOPT_PROXY_SSLVERSION
Proxy SSL version to use. See CURLOPT_PROXY_SSLVERSION
CURLOPT_SSL_VERIFYHOST
Verify the host name in the SSL certificate. See CURLOPT_SSL_VERIFYHOST
CURLOPT_PROXY_SSL_VERIFYHOST
Verify the host name in the proxy SSL certificate. See CURLOPT_PROXY_SSL_VERIFYHOST
CURLOPT_SSL_VERIFYPEER
Verify the SSL certificate. See CURLOPT_SSL_VERIFYPEER
CURLOPT_PROXY_SSL_VERIFYPEER
Verify the proxy SSL certificate. See CURLOPT_PROXY_SSL_VERIFYPEER
CURLOPT_SSL_VERIFYSTATUS
Verify the SSL certificate's status. See CURLOPT_SSL_VERIFYSTATUS
CURLOPT_CAINFO
CA cert bundle. See CURLOPT_CAINFO
CURLOPT_PROXY_CAINFO
Proxy CA cert bundle. See CURLOPT_PROXY_CAINFO
CURLOPT_ISSUERCERT
Issuer certificate. See CURLOPT_ISSUERCERT
CURLOPT_CAPATH
Path to CA cert bundle. See CURLOPT_CAPATH
CURLOPT_PROXY_CAPATH
Path to proxy CA cert bundle. See CURLOPT_PROXY_CAPATH
CURLOPT_CRLFILE
Certificate Revocation List. See CURLOPT_CRLFILE
CURLOPT_PROXY_CRLFILE
Proxy Certificate Revocation List. See CURLOPT_PROXY_CRLFILE
CURLOPT_CERTINFO
Extract certificate info. See CURLOPT_CERTINFO
CURLOPT_PINNEDPUBLICKEY
Set pinned SSL public key . See CURLOPT_PINNEDPUBLICKEY
CURLOPT_PROXY_PINNEDPUBLICKEY
Set the proxy's pinned SSL public key. See CURLOPT_PROXY_PINNEDPUBLICKEY
CURLOPT_RANDOM_FILE
Provide source for entropy random data. See CURLOPT_RANDOM_FILE
CURLOPT_EGDSOCKET
Identify EGD socket for entropy. See CURLOPT_EGDSOCKET
CURLOPT_SSL_CIPHER_LIST
Ciphers to use. See CURLOPT_SSL_CIPHER_LIST
CURLOPT_PROXY_SSL_CIPHER_LIST
Proxy ciphers to use. See CURLOPT_PROXY_SSL_CIPHER_LIST
CURLOPT_TLS13_CIPHERS
TLS 1.3 cipher suites to use. See CURLOPT_TLS13_CIPHERS
CURLOPT_PROXY_TLS13_CIPHERS
Proxy TLS 1.3 cipher suites to use. See CURLOPT_PROXY_TLS13_CIPHERS
CURLOPT_SSL_SESSIONID_CACHE
Disable SSL session-id cache. See CURLOPT_SSL_SESSIONID_CACHE
CURLOPT_SSL_OPTIONS
Control SSL behavior. See CURLOPT_SSL_OPTIONS
CURLOPT_PROXY_SSL_OPTIONS
Control proxy SSL behavior. See CURLOPT_PROXY_SSL_OPTIONS
CURLOPT_KRBLEVEL
Kerberos security level. See CURLOPT_KRBLEVEL
CURLOPT_GSSAPI_DELEGATION
Disable GSS-API delegation. See CURLOPT_GSSAPI_DELEGATION
CURLOPT_SSH_AUTH_TYPES
SSH authentication types. See CURLOPT_SSH_AUTH_TYPES
CURLOPT_SSH_COMPRESSION
Enable SSH compression. See CURLOPT_SSH_COMPRESSION
CURLOPT_SSH_HOST_PUBLIC_KEY_MD5
MD5 of host's public key. See CURLOPT_SSH_HOST_PUBLIC_KEY_MD5
CURLOPT_SSH_PUBLIC_KEYFILE
File name of public key. See CURLOPT_SSH_PUBLIC_KEYFILE
CURLOPT_SSH_PRIVATE_KEYFILE
File name of private key. See CURLOPT_SSH_PRIVATE_KEYFILE
CURLOPT_SSH_KNOWNHOSTS
File name with known hosts. See CURLOPT_SSH_KNOWNHOSTS
CURLOPT_SSH_KEYFUNCTION
Callback for known hosts handling. See CURLOPT_SSH_KEYFUNCTION
CURLOPT_SSH_KEYDATA
Custom pointer to pass to ssh key callback. See CURLOPT_SSH_KEYDATA
CURLOPT_PRIVATE
Private pointer to store. See CURLOPT_PRIVATE
CURLOPT_SHARE
Share object to use. See CURLOPT_SHARE
CURLOPT_NEW_FILE_PERMS
Mode for creating new remote files. See CURLOPT_NEW_FILE_PERMS
CURLOPT_NEW_DIRECTORY_PERMS
Mode for creating new remote directories. See CURLOPT_NEW_DIRECTORY_PERMS
CURLOPT_TELNETOPTIONS
TELNET options. See CURLOPT_TELNETOPTIONS
CURLE_OK (zero) means that the option was set properly, non-zero means an error occurred as
If you try to set an option that libcurl doesn't know about, perhaps because the library is too old to support it or the option was removed in a recent version, this function will return CURLE_UNKNOWN_OPTION. If support for the option was disabled at compile-time, it will return CURLE_NOT_BUILT_IN.
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
使用libcurl步骤1之curl_global_init
使用libcurl步骤2之curl_easy_init
使用libcurl步骤3之curl_easy_setopt
使用libcurl步骤4之curl_easy_perform
使用libcurl步骤5之curl_easy_cleanup