PHP CURL curl_setopt parameter
Aug 08, 2016 am 09:24 AMPHP CURL curl_setopt parameters
bool curl_setopt (int ch, string option, mixed value)
curl_setopt() function will set options for a CURL session. The option parameter is the setting you want, and value is the value given by this option.
The values ??of the following options will be used as long integers (specified in the option parameter): CURLOPT_INFILESIZE: When you upload a file to the remote site, this option tells PHP the size of the file you are uploading. ? CURLOPT_VERBOSE : If you want CURL to report every unexpected event, set this option to a non-zero value.
? CURLOPT_HEADER : If you want to include a header in the output, set this option to a non-zero value.
? CURLOPT_NOPROGRESS: If you don't want PHP to display a progress bar for CURL transfers, set this option to a non-zero value. Note: PHP automatically sets this option to a non-zero value, you should only change this option for debugging purposes.
? CURLOPT_NOBODY : If you don’t want to include the body part in the output, set this option to a non-zero value.
? CURLOPT_FAILONERROR: If you want PHP not to display when an error occurs (HTTP code return greater than or equal to 300), set this option to a non-zero value. The default behavior is to return a normal page and ignore the code.
? CURLOPT_UPLOAD: If you want PHP to prepare for uploading, set this option to a non-zero value.
? CURLOPT_POST: If you want PHP to do a regular HTTP POST, set this option to a non-zero value. This POST is of the ordinary application/x-www-from-urlencoded type, mostly used by HTML forms.
? CURLOPT_FTPLISTONLY: Set this option to a non-zero value and PHP will list the FTP directory name list.
? CURLOPT_FTPAPPEND : Set this option to a non-zero value and PHP will apply the remote file instead of overwriting it.
? CURLOPT_NETRC: Set this option to a non-zero value and PHP will look in your ~./netrc file for the username and password of the remote site you want to connect to.
? CURLOPT_FOLLOWLOCATION : Set this option to a non-zero header (like "Location: "), and the server will send it as part of the HTTP header (note that this is recursive, PHP will send a header like "Location: ") ).
? CURLOPT_PUT : Set this option to a non-zero value to upload a file using HTTP. To upload this file, the CURLOPT_INFILE and CURLOPT_INFILESIZE options must be set.
? CURLOPT_MUTE: Set this option to a non-zero value, and PHP will be completely silent for the CURL function.
? CURLOPT_TIMEOUT: Set a long integer as the maximum number of seconds.
? CURLOPT_LOW_SPEED_LIMIT: Set a long integer to control how many bytes are transmitted.
? CURLOPT_LOW_SPEED_TIME: Set a long integer to control how many seconds to transmit the number of bytes specified by CURLOPT_LOW_SPEED_LIMIT.
? CURLOPT_RESUME_FROM: Pass a long integer parameter containing the byte offset address (the start form you want to transfer to).
? CURLOPT_SSLVERSION: Pass a long parameter containing the SSL version. By default PHP will be determined by its own efforts, in more security you have to set it manually.
? CURLOPT_TIMECONDITION: Pass a long parameter to specify how to handle the CURLOPT_TIMEVALUE parameter. You can set this parameter to TIMECOND_IFMODSINCE or TIMECOND_ISUNMODSINCE. This is only for HTTP.
? CURLOPT_TIMEVALUE: Pass a number of seconds from 1970-1-1 to now. This time will be used as the specified value by the CURLOPT_TIMEVALUE option, or by the default TIMECOND_IFMODSINCE.
The values ??of the following options will be treated as strings:
? CURLOPT_URL: This is the URL address you want to retrieve using PHP. You can also set this option during initialization with the curl_init() function.
? CURLOPT_USERPWD: Pass a string in the form of [username]:[password] and use PHP to connect.
? CURLOPT_PROXYUSERPWD: Pass a string in the format [username]:[password] to connect to the HTTP proxy.
? CURLOPT_RANGE: Pass a range you want to specify. It should be in "X-Y" format, with X or Y being excluded. HTTP transfers also support several intervals, separated by commas (X-Y,N-M).
? CURLOPT_POSTFIELDS: Pass a string containing all the data as an HTTP "POST" operation.
? CURLOPT_REFERER: A string containing a "referer" header in the HTTP request.
? CURLOPT_USERAGENT: A string containing a "user-agent" header in the HTTP request.
? CURLOPT_FTPPORT: Pass an IP address containing the IP address used by the ftp "POST" command. This POST instruction tells the remote server to connect to the IP address we specified. This string can be an IP address, a host name, a network interface name (under UNIX), or '-' (use the system default IP address).
? CURLOPT_COOKIE: Pass a header connection containing an HTTP cookie.
? CURLOPT_SSLCERT: Pass a string containing the certificate in PEM format.
? CURLOPT_SSLCERTPASSWD: Pass a password containing the necessary password to use the CURLOPT_SSLCERT certificate.
? CURLOPT_COOKIEFILE: Pass a string containing the name of the file containing cookie data. This cookie file can be in Netscape format, or it can be a stack of HTTP-style headers stored in the file.
? CURLOPT_CUSTOMREQUEST: When making an HTTP request, pass a character to be used by GET or HEAD. Pass a string to be used instead of GET or HEAD when doing an HTTP request. This is useful for doing or another, more obscure, HTTP request. Note: Make sure your server supports Order not to do it yet. The following options require a file description (obtained by using the fopen() function):
? CURLOPT_FILE: This file will be the output file you place and transmit. The default is STDOUT.
? CURLOPT_INFILE: This file will be the input file you transmit.
? CURLOPT_WRITEHEADER: This file contains the header part of your output.
? CURLOPT_STDERR : This file has errors written instead of stderr. Examples used to obtain pages that require login. The current method is to log in once every time. Those who need it will make improvements.
Example 1:
Flash forum code:
1. Cookie grabbing program:
2. Clean the building:
CURL related functions
curl_close — 關(guān)閉一個(gè)curl會(huì)話
curl_copy_handle — 拷貝一個(gè)curl連接資源的所有內(nèi)容和參數(shù)
curl_errno — 返回一個(gè)包含當(dāng)前會(huì)話錯(cuò)誤信息的數(shù)字編號(hào)
curl_error — 返回一個(gè)包含當(dāng)前會(huì)話錯(cuò)誤信息的字符串
curl_exec — 執(zhí)行一個(gè)curl會(huì)話
curl_getinfo — 獲取一個(gè)curl連接資源句柄的信息
curl_init — 初始化一個(gè)curl會(huì)話
curl_multi_add_handle — 向curl批處理會(huì)話中添加單獨(dú)的curl句柄資源
curl_multi_close — 關(guān)閉一個(gè)批處理句柄資源
curl_multi_exec — 解析一個(gè)curl批處理句柄
curl_multi_getcontent — 返回獲取的輸出的文本流
curl_multi_info_read — 獲取當(dāng)前解析的curl的相關(guān)傳輸信息
curl_multi_init — 初始化一個(gè)curl批處理句柄資源
curl_multi_remove_handle — 移除curl批處理句柄資源中的某個(gè)句柄資源
curl_multi_select — Get all the sockets associated with the cURL extension, which can then be "selected"
curl_setopt_array — 以數(shù)組的形式為一個(gè)curl設(shè)置會(huì)話參數(shù)
curl_setopt — 為一個(gè)curl設(shè)置會(huì)話參數(shù)
curl_version — 獲取curl相關(guān)的版本信息
curl_init()函數(shù)的作用初始化一個(gè)curl會(huì)話,curl_init()函數(shù)唯一的一個(gè)參數(shù)是可選的,表示一個(gè)url地址。
curl_exec()函數(shù)的作用是執(zhí)行一個(gè)curl會(huì)話,唯一的參數(shù)是curl_init()函數(shù)返回的句柄。
curl_close()函數(shù)的作用是關(guān)閉一個(gè)curl會(huì)話,唯一的參數(shù)是curl_init()函數(shù)返回的句柄。
curl_version()函數(shù)的作用是獲取curl相關(guān)的版本信息,curl_version()函數(shù)有一個(gè)參數(shù),不清楚是做什么的
curl_getinfo()函數(shù)的作用是獲取一個(gè)curl連接資源句柄的信息,curl_getinfo()函數(shù)有兩個(gè)參數(shù),第一個(gè)參數(shù)是curl的資源句柄,第二個(gè)參數(shù)是下面一些常量:
可選的常量包括:
CURLINFO_EFFECTIVE_URL
最后一個(gè)有效的url地址
CURLINFO_HTTP_CODE
最后一個(gè)收到的HTTP代碼
CURLINFO_FILETIME
遠(yuǎn)程獲取文檔的時(shí)間,如果無法獲取,則返回值為“-1”
CURLINFO_TOTAL_TIME
最后一次傳輸所消耗的時(shí)間
CURLINFO_NAMELOOKUP_TIME
名稱解析所消耗的時(shí)間
CURLINFO_CONNECT_TIME
建立連接所消耗的時(shí)間
CURLINFO_PRETRANSFER_TIME
從建立連接到準(zhǔn)備傳輸所使用的時(shí)間
CURLINFO_STARTTRANSFER_TIME
從建立連接到傳輸開始所使用的時(shí)間
CURLINFO_REDIRECT_TIME
在事務(wù)傳輸開始前重定向所使用的時(shí)間
CURLINFO_SIZE_UPLOAD
上傳數(shù)據(jù)量的總值
CURLINFO_SIZE_DOWNLOAD
下載數(shù)據(jù)量的總值
CURLINFO_SPEED_DOWNLOAD
平均下載速度
CURLINFO_SPEED_UPLOAD
平均上傳速度
CURLINFO_HEADER_SIZE
header部分的大小
CURLINFO_HEADER_OUT
發(fā)送請(qǐng)求的字符串
CURLINFO_REQUEST_SIZE
在HTTP請(qǐng)求中有問題的請(qǐng)求的大小
CURLINFO_SSL_VERIFYRESULT
Result of SSL certification verification requested by setting CURLOPT_SSL_VERIFYPEER
CURLINFO_CONTENT_LENGTH_DOWNLOAD
從Content-Length: field中讀取的下載內(nèi)容長度
CURLINFO_CONTENT_LENGTH_UPLOAD
上傳內(nèi)容大小的說明
CURLINFO_CONTENT_TYPE
下載內(nèi)容的“Content-type”值,NULL表示服務(wù)器沒有發(fā)送有效的“Content-Type: header”
curl_setopt()函數(shù)的作用是為一個(gè)curl設(shè)置會(huì)話參數(shù)。curl_setopt_array()函數(shù)的作用是以數(shù)組的形式為一個(gè)curl設(shè)置會(huì)話參數(shù)。
The parameters that can be set are:
CURLOPT_AUTOREFERER
Automatically set the referer information in the header
CURLOPT_BINARYTRANSFER
When CURLOPT_RETURNTRANSFER is enabled, the data will be returned
CURLOPT_COOKIESESSION
When enabled, curl will only pass a session cookie and ignore others cookie, default In this case curl will return all cookies to the server. Session cookies refer to cookies that are used to determine whether the server-side session is valid.
CURLOPT_CRLF
When enabled, convert Unix line feed characters into carriage return and line feed characters.
CURLOPT_DNS_USE_GLOBAL_CACHE
When enabled, a global DNS cache is enabled. This item is thread-safe and defaults to true.
CURLOPT_FAILONERROR
Displays the HTTP status code. The default behavior is to ignore HTTP information with a number less than or equal to 400.
CURLOPT_FILETIME
When enabled, it will try to modify the information in the remote document. The result information will be returned through the CURLINFO_FILETIME option of the curl_getinfo() function.
CURLOPT_FOLLOWLOCATION
When enabled, the "Location:" returned by the server will be placed in the header and returned to the server recursively. Use CURLOPT_MAXREDIRS to limit the number of recursive returns.
CURLOPT_FORBID_REUSE
Forcibly disconnect after completing the interaction and cannot be reused.
CURLOPT_FRESH_CONNECT
Force a new connection to replace the one in the cache.
CURLOPT_FTP_USE_EPRT
TRUE to use EPRT (and LPRT) when doing active FTP downloads. Use FALSE to disable EPRT and LPRT and use PORT only.
Added in PHP 5.0.0.
CURLOPT_FTP_USE_EPSV
TRUE to first try an EPSV command for FTP transfers before reverting back to PASV. Set to FALSE to disable EPSV.
CURLOPT_FTPAPPEND
TRUE to append to the remote file instead of overwriting it.
CURLOPT_FTPASCII
An alias of CURLOPT_TRANSFERTEXT. Use that instead.
CURLOPT_FTPLISTONLY
TRUE to only list the names of an FTP directory.
CURLOPT_HEADER
When enabled, the header file information will be output as a data stream.
CURLOPT_HTTPGET
When enabled, the HTTP method will be set to GET. Because GET is the default, it is only used when it is modified.
CURLOPT_HTTPPROXYTUNNEL
When enabled, it will be transmitted through HTTP proxy.
CURLOPT_MUTE
Restore all modified parameters in the curl function to their default values.
CURLOPT_NETRC
After the connection is established, access the ~/.netrc file to obtain the username and password information to connect to the remote site.
CURLOPT_NOBODY
When enabled, the body part in HTML will not be output.
CURLOPT_NOPROGRESS
Turn off the progress bar of curl transmission when enabled. The default setting of this item is true
CURLOPT_NOSIGNAL
Ignore all signals passed by curl to PHP when enabled. This item is turned on by default during SAPI multi-thread transmission.
CURLOPT_POST
When enabled, a regular POST request will be sent of type: application/x-www-form-urlencoded, just like a form submission.
CURLOPT_PUT
When enabled, HTTP is allowed to send files. CURLOPT_INFILE and CURLOPT_INFILESIZE must be set at the same time.
CURLOPT_RETURNTRANSFER
The information obtained by curl_exec() is returned in the form of a file stream instead of being output directly.
CURLOPT_SSL_VERIFYPEER
FALSE to stop cURL from verifying the peer's certificate. Alternate certificates to verify against can be specified with the CURLOPT_CAINFO option or a certificate directory can be specified with the CURLOPT_CAPATH option. CURLOPT_SSL_VERIFYHOST may also need
to be TRUE or FALSE if CURLOPT_SSL_VERIFYPEER is disabled (it defaults to 2). TRUE by default as of cURL 7.10. Default bundle installed as of cURL 7.10.
CURLOPT_TRANSFERTEXT
TRUE to use ASCII mode for FTP transfers. in plain text instead of HTML. On Windows systems, it will not set STDOUT to binary mode.
CURLOPT_UNRESTRICTED_AUTH
Continuously append username and password information to multiple locations in the header generated using CURLOPT_FOLLOWLOCATION, even if the domain name has changed.
CURLOPT_UPLOAD
Allows file transfer when enabled
CURLOPT_VERBOSE
When enabled, all information will be reported and stored in STDERR or the specified CURLOPT_STDERR
CURLOPT_BUFFERSIZE
The size of the cache is read each time the data is obtained, and this value will be filled every time .
CURLOPT_CLOSEPOLICY
It is either CURLCLOSEPOLICY_LEAST_RECENTLY_USED or CURLCLOSEPOLICY_OLDEST. There are three others, but curl does not support them yet. .
CURLOPT_CONNECTTIMEOUT
The time to wait before initiating a connection. If set to 0, there will be no waiting.
CURLOPT_DNS_CACHE_TIMEOUT
Set the time to save DNS information in memory, the default is 120 seconds.
CURLOPT_FTPSSLAUTH
The FTP authentication method (when is activated): CURLFTPAUTH_SSL (try SSL first), CURLFTPAUTH_TLS (try TLS first), or CURLFTPAUTH_DEFAULT (let cURL decide).
CURLOPT_HTTP_VERSION
Set the HTTP protocol used by curl, CURL_HTTP_VERSION_NONE (let curl myself Judgment), CURL_HTTP_VERSION_1_0 (HTTP/1.0), CURL_HTTP_VERSION_1_1 (HTTP/1.1)
CURLOPT_HTTPAUTH
The HTTP verification method used, the optional values ??are: CURLAUTH_BASIC, CURLAUTH_DIGEST, CURLAUTH_GSSNEGOTIATE, CURLAUTH_NTLM, CURLAUTH_ANY, CURLAU TH_ANYSAFE, you can use the "|" operator Separate multiple values, curl lets the server choose the one with the best support, CURLAUTH_ANY is equivalent to CURLAUTH_BASIC | CURLAUTH_DIGEST | CURLAUTH_GSSNEGOTIATE | CURLAUTH_NTLM, CURLAUTH_ANYSAFE is equivalent to CURLAUTH_DIGEST
| CURLAUTH_GSSNEGOTIATE | CURLAUTH_NTLM
CURLOPT_INFILESIZE
Set the size of the uploaded file
CURLOPT_LOW_SPEED_LIMIT
When the transfer speed is less than CURLOPT_LOW_SPEED_LIMIT, PHP will use CURLOPT_LOW_SPEED_TIME to determine whether to cancel the transfer because it is too slow.
CURLOPT_LOW_SPEED_TIME
The number of seconds the transfer should be below CURLOPT_LOW_SPEED_LIMIT for PHP to consider the transfer too slow and abort.
CURLOPT_MAXCONNECTS
The maximum number of connections allowed. If exceeded, CURLOPT_CLOSEPOLICY will be used to determine which connections should be stopped.
CURLOPT_MAXREDIRS
Specify the maximum number of HTTP redirects. This option is used together with CURLOPT_FOLLOWLOCATION.
CURLOPT_PORT
An optional quantity used to specify the connection port
CURLOPT_PROXYAUTH
The HTTP authentication method(s) to use for the proxy connection. Use the same bitmasks as described in CURLOPT_HTTPAUTH. For proxy authentication, only CURLAUTH_BASIC and CURLAUTH_NTLM are currently
CURLOPT_PROXYPORT
The port number of the proxy to connect to. (Used to resume downloading from breakpoints)
CURLOPT_SSL_VERIFYHOST
1 to check the existence of a common name in the SSL peer certificate.
2 to check the existence of a common name and also verify that it matches the hostname provided.
CURLOPT_SSLVERSION
The SSL version (2 or 3) to use. By default PHP will try to determine this itself, although in some cases this must be set manually.
CURLOPT_TIMECONDITION
If edited after a certain time specified by CURLOPT_TIMEVALUE, use CURL_TIMECOND_IFMODSINCE to return If the page has not been modified and CURLOPT_HEADER is true, a "304 Not Modified" header will be returned. If CURLOPT_HEADER is false, CURL_TIMECOND_ISUNMODSINCE will be used. The default value is CURL_TIMECOND_IFMODSINCE
CURLOPT_TIMEOUT
Set the maximum number of seconds curl is allowed to execute
CURLOPT_TIMEVALUE
Set a timestamp used by CURLOPT_TIMECONDITION. By default, CURL_TIMECOND_IFMODSINCE is used.
CURLOPT_CAINFO
The name of a file holding one or more certificates to verify the peer with. This only makes sense when used in combination with CURLOPT_SSL_VERIFYPEER.
CURLOPT_CAPATH
A directory that holds multiple CA certificates. Use this option alongside CURLOPT_SSL_VERIFYPEER.
CURLOPT_COOKIE
Set the content of the "Set-Cookie:" part of the HTTP request.
CURLOPT_COOKIEFILE
The name of the file containing cookie information. This cookie file can be Netscape format or HTTP style header information.
CURLOPT_COOKIEJAR
The name of the file that stores cookie information after the connection is closed
CURLOPT_CUSTOMREQUEST
A custom request method to use instead of "GET" or "HEAD" when doing a HTTP request. This is useful for doing "DELETE" or other, more obscure HTTP requests. Valid values ??are things like "GET", "POST", "CONNECT" and so on; i.e. Do not enter a whole HTTP request
line here. For instance, entering "GET /index.html HTTP/1.0rnrn" would be incorrect.
Note: Don't do this without making sure the server supports the custom request method first.
CURLOPT_EGBSOCKET
Like CURLOPT_RANDOM_FILE, except a filename to an Entropy Gathering Daemon socket.
CURLOPT_ENCODING
The content of the "Accept-Encoding:" part of the header. The supported encoding formats are: "identity", "deflate", "gzip".如果設(shè)置為空字符串,則表示支持所有的編碼格式
CURLOPT_FTPPORT
The value which will be used to get the IP address to use for the FTP "POST" instruction. The "POST" instruction tells the remote server to connect to our specified IP address. The string may be a plain IP address, a hostname, a network interface name (under
Unix), or just a plain '-' to use the systems default IP address.
CURLOPT_INTERFACE
在外部網(wǎng)絡(luò)接口中使用的名稱,可以是一個(gè)接口名,IP或者主機(jī)名。
CURLOPT_KRB4LEVEL
KRB4(Kerberos 4)安全級(jí)別的設(shè)置,可以是一下幾個(gè)值之一:"clear","safe","confidential","private"。默認(rèn)的值 為"private",設(shè)置為null的時(shí)候表示禁用KRB4,現(xiàn)在KRB4安全僅能在FTP傳輸中使用。
CURLOPT_POSTFIELDS
在HTTP中的“POST”操作。如果要傳送一個(gè)文件,需要一個(gè)@開頭的文件名
CURLOPT_PROXY
設(shè)置通過的HTTP代理服務(wù)器
CURLOPT_PROXYUSERPWD
連接到代理服務(wù)器的,格式為“[username]:[password]”的用戶名和密碼。
CURLOPT_RANDOM_FILE
設(shè)定存放SSL用到的隨機(jī)數(shù)種子的文件名稱
CURLOPT_RANGE
設(shè)置HTTP傳輸范圍,可以用“X-Y”的形式設(shè)置一個(gè)傳輸區(qū)間,如果有多個(gè)HTTP傳輸,則使用逗號(hào)分隔多個(gè)值,形如:"X-Y,N-M"。
CURLOPT_REFERER
設(shè)置header中"Referer: " 部分的值。
CURLOPT_SSL_CIPHER_LIST
A list of ciphers to use for SSL. For example, RC4-SHA and TLSv1 are valid cipher lists.
CURLOPT_SSLCERT
傳遞一個(gè)包含PEM格式證書的字符串。
CURLOPT_SSLCERTPASSWD
傳遞一個(gè)包含使用CURLOPT_SSLCERT證書必需的密碼。
CURLOPT_SSLCERTTYPE
The format of the certificate. Supported formats are "PEM" (default), "DER", and "ENG".
CURLOPT_SSLENGINE
The identifier for the crypto engine of the private SSL key specified in CURLOPT_SSLKEY.
CURLOPT_SSLENGINE_DEFAULT
The identifier for the crypto engine used for asymmetric crypto operations.
CURLOPT_SSLKEY
The name of a file containing a private SSL key.
CURLOPT_SSLKEYPASSWD
The secret password needed to use the private SSL key specified in CURLOPT_SSLKEY.
Note: Since this option contains a sensitive password, remember to keep the PHP script it is contained within safe.
CURLOPT_SSLKEYTYPE
The key type of the private SSL key specified in CURLOPT_SSLKEY. Supported key types are "PEM" (default), "DER", and "ENG".
CURLOPT_URL
需要獲取的URL地址,也可以在PHP的curl_init()函數(shù)中設(shè)置。
CURLOPT_USERAGENT
在HTTP請(qǐng)求中包含一個(gè)”user-agent”頭的字符串。
CURLOPT_USERPWD
傳遞一個(gè)連接中需要的用戶名和密碼,格式為:“[username]:[password]”。
CURLOPT_HTTP200ALIASES
設(shè)置不再以error的形式來處理HTTP 200的響應(yīng),格式為一個(gè)數(shù)組。
CURLOPT_HTTPHEADER
設(shè)置一個(gè)header中傳輸內(nèi)容的數(shù)組。
CURLOPT_POSTQUOTE
An array of FTP commands to execute on the server after the FTP request has been performed.
CURLOPT_QUOTE
An array of FTP commands to execute on the server prior to the FTP request.
CURLOPT_FILE
設(shè)置輸出文件的位置,值是一個(gè)資源類型,默認(rèn)為STDOUT (瀏覽器)。
CURLOPT_INFILE
在上傳文件的時(shí)候需要讀取的文件地址,值是一個(gè)資源類型。
CURLOPT_STDERR
設(shè)置一個(gè)錯(cuò)誤輸出地址,值是一個(gè)資源類型,取代默認(rèn)的STDERR。
CURLOPT_WRITEHEADER
設(shè)置header部分內(nèi)容的寫入的文件地址,值是一個(gè)資源類型。
CURLOPT_HEADERFUNCTION
設(shè)置一個(gè)回調(diào)函數(shù),這個(gè)函數(shù)有兩個(gè)參數(shù),第一個(gè)是curl的資源句柄,第二個(gè)是輸出的header數(shù)據(jù)。header數(shù)據(jù)的輸出必須依賴這個(gè)函數(shù),返回已寫入的數(shù)據(jù)大小。
CURLOPT_PASSWDFUNCTION
設(shè)置一個(gè)回調(diào)函數(shù),有三個(gè)參數(shù),第一個(gè)是curl的資源句柄,第二個(gè)是一個(gè)密碼提示符,第三個(gè)參數(shù)是密碼長度允許的最大值。返回密碼的值。
CURLOPT_READFUNCTION
設(shè)置一個(gè)回調(diào)函數(shù),有兩個(gè)參數(shù),第一個(gè)是curl的資源句柄,第二個(gè)是讀取到的數(shù)據(jù)。數(shù)據(jù)讀取必須依賴這個(gè)函數(shù)。返回讀取數(shù)據(jù)的大小,比如0或者EOF。
CURLOPT_WRITEFUNCTION
設(shè)置一個(gè)回調(diào)函數(shù),有兩個(gè)參數(shù),第一個(gè)是curl的資源句柄,第二個(gè)是寫入的數(shù)據(jù)。數(shù)據(jù)寫入必須依賴這個(gè)函數(shù)。返回精確的已寫入數(shù)據(jù)的大小
curl_copy_handle()函數(shù)的作用是拷貝一個(gè)curl連接資源的所有內(nèi)容和參數(shù)
curl_error()函數(shù)的作用是返回一個(gè)包含當(dāng)前會(huì)話錯(cuò)誤信息的字符串。
curl_errno()函數(shù)的作用是返回一個(gè)包含當(dāng)前會(huì)話錯(cuò)誤信息的數(shù)字編號(hào)。
curl_multi_init()函數(shù)的作用是初始化一個(gè)curl批處理句柄資源。
curl_multi_add_handle()函數(shù)的作用是向curl批處理會(huì)話中添加單獨(dú)的curl句柄資源。curl_multi_add_handle()函數(shù)有兩個(gè)參數(shù),第一個(gè)參數(shù)表示一個(gè)curl批處理句柄資源,第二個(gè)參數(shù)表示一個(gè)單獨(dú)的curl句柄資源。
curl_multi_exec()函數(shù)的作用是解析一個(gè)curl批處理句柄,curl_multi_exec()函數(shù)有兩個(gè)參數(shù),第一個(gè)參數(shù)表示一個(gè)批處理句柄資源,第二個(gè)參數(shù)是一個(gè)引用值的參數(shù),表示剩余需要處理的單個(gè)的curl句柄資源數(shù)量。
curl_multi_remove_handle()函數(shù)表示移除curl批處理句柄資源中的某個(gè)句柄資源,curl_multi_remove_handle()函數(shù)有兩個(gè)參數(shù),第一個(gè)參數(shù)表示一個(gè)curl批處理句柄資源,第二個(gè)參數(shù)表示一個(gè)單獨(dú)的curl句柄資源。
curl_multi_close()函數(shù)的作用是關(guān)閉一個(gè)批處理句柄資源。
curl_multi_getcontent()函數(shù)的作用是在設(shè)置了CURLOPT_RETURNTRANSFER的情況下,返回獲取的輸出的文本流。
curl_multi_info_read()函數(shù)的作用是獲取當(dāng)前解析的curl的相關(guān)傳輸信息。
curl_multi_select()
Get all the sockets associated with the cURL extension, which can then be "selected"
以上就介紹了PHP CURL curl_setopt 參數(shù),包括了方面的內(nèi)容,希望對(duì)PHP教程有興趣的朋友有所幫助。

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

The message "Your organization has asked you to change your PIN" will appear on the login screen. This happens when the PIN expiration limit is reached on a computer using organization-based account settings, where they have control over personal devices. However, if you set up Windows using a personal account, the error message should ideally not appear. Although this is not always the case. Most users who encounter errors report using their personal accounts. Why does my organization ask me to change my PIN on Windows 11? It's possible that your account is associated with an organization, and your primary approach should be to verify this. Contacting your domain administrator can help! Additionally, misconfigured local policy settings or incorrect registry keys can cause errors. Right now

Windows 11 brings fresh and elegant design to the forefront; the modern interface allows you to personalize and change the finest details, such as window borders. In this guide, we'll discuss step-by-step instructions to help you create an environment that reflects your style in the Windows operating system. How to change window border settings? Press + to open the Settings app. WindowsI go to Personalization and click Color Settings. Color Change Window Borders Settings Window 11" Width="643" Height="500" > Find the Show accent color on title bar and window borders option, and toggle the switch next to it. To display accent colors on the Start menu and taskbar To display the theme color on the Start menu and taskbar, turn on Show theme on the Start menu and taskbar

Screen brightness is an integral part of using modern computing devices, especially when you look at the screen for long periods of time. It helps you reduce eye strain, improve legibility, and view content easily and efficiently. However, depending on your settings, it can sometimes be difficult to manage brightness, especially on Windows 11 with the new UI changes. If you're having trouble adjusting brightness, here are all the ways to manage brightness on Windows 11. How to Change Brightness on Windows 11 [10 Ways Explained] Single monitor users can use the following methods to adjust brightness on Windows 11. This includes desktop systems using a single monitor as well as laptops. let's start. Method 1: Use the Action Center The Action Center is accessible

HTTP status code 520 means that the server encountered an unknown error while processing the request and cannot provide more specific information. Used to indicate that an unknown error occurred when the server was processing the request, which may be caused by server configuration problems, network problems, or other unknown reasons. This is usually caused by server configuration issues, network issues, server overload, or coding errors. If you encounter a status code 520 error, it is best to contact the website administrator or technical support team for more information and assistance.

In iOS 17, Apple introduced several new privacy and security features to its mobile operating system, one of which is the ability to require two-step authentication for private browsing tabs in Safari. Here's how it works and how to turn it off. On an iPhone or iPad running iOS 17 or iPadOS 17, Apple's browser now requires Face ID/Touch ID authentication or a passcode if you have any Private Browsing tab open in Safari and then exit the session or app to access them again. In other words, if someone gets their hands on your iPhone or iPad while it's unlocked, they still won't be able to view your privacy without knowing your passcode

To update the curl version under Linux, you can follow the steps below: Check the current curl version: First, you need to determine the curl version installed in the current system. Open a terminal and execute the following command: curl --version This command will display the current curl version information. Confirm available curl version: Before updating curl, you need to confirm the latest version available. You can visit curl's official website (curl.haxx.se) or related software sources to find the latest version of curl. Download the curl source code: Using curl or a browser, download the source code file for the curl version of your choice (usually .tar.gz or .tar.bz2

The famous activation script MAS2.2 version supports digital activation again. The method originated from @asdcorp and the team. The MAS author calls it HWID2. Download gatherosstate.exe (not original, modified) from https://github.com/massgravel/Microsoft-Activation-Scripts, run it with parameters, and generate GenuineTicket.xml. First take a look at the original method: gatherosstate.exePfn=xxxxxxx;DownlevelGenuineState=1 and then compare with the latest method: gatheros
![How to Hide and Unhide Folders on Windows 11 [3 Ways]](https://img.php.cn/upload/article/000/887/227/169542942766265.jpg?x-oss-process=image/resize,m_fill,h_207,w_330)
Hiding folders is a great way to keep your desktop organized. Maybe you want to keep your personal files or some client details away from prying eyes. Whatever it is, the ability to put them away and unhide them when necessary is a big saver. In short, these hidden files will not show up in the main menu, but they will still be accessible. It's very simple and shouldn't take you too much time. How to hide a folder in Windows 11? 1. Use File Explorer and hit the + key to open File Explorer. WindowsE Find the folder you want to hide, right-click it and select Properties. Navigate to the General tab, check the Hide box, click Apply, and then click OK. In the next dialog box, check Apply changes to this folder, sub-folder
