English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

PHP Basic Tutorial

PHP Advanced Tutorial

PHP & MySQL

PHP Reference Manual

PHP curl_multi_setopt() Function Usage and Example

PHP CURL Reference Manual

(PHP 5 >= 5.5.0)

curl_multi_setopt — Set a batch CURL transfer option.

Description

bool curl_multi_setopt ( resource $mh , int $option , mixed $value )

Set a batch CURL transfer option.

Parameter

ch

The CURL handle returned by curl_init().

option

The CURLOPT_XXX option that needs to be set.

value

The value set on the option option.

For the optional parameters of the following options, the value should be set to a boolean value:

OptionsOptionalvalueValueNotes
CURLOPT_AUTOREFERERWhen based onLocation:Automatically set the header in the case of redirection.Referer:information.
CURLOPT_BINARYTRANSFERWhen enabledCURLOPT_RETURNTRANSFERReturns the original (Raw) output.
CURLOPT_COOKIESESSIONWhen enabled, curl will only pass a session cookie, ignoring other cookies. By default, CURL will return all cookies to the server. A session cookie refers to cookies that exist to determine if the server-side session is valid.
CURLOPT_CRLFWhen enabled, Unix newline characters are converted to carriage return newline characters.
CURLOPT_DNS_USE_GLOBAL_CACHEWhen enabled, it will enable a global DNS cache, which is thread-safe and enabled by default.
CURLOPT_FAILONERRORDisplay HTTP status code, the default behavior is to ignore numbers less than or equal to400 HTTP information.
CURLOPT_FILETIMEWhen enabled, it will attempt to modify the information in the remote document. The result information will be passed through the curl_getinfo() function'sCURLINFO_FILETIMEoptions return.            curl_getinfo().
CURLOPT_FOLLOWLOCATIONWhen enabled, it will return the server's response"Location: "Place the recursive return in the header and return it to the server usingCURLOPT_MAXREDIRSThe number of recursive returns can be limited.
CURLOPT_FORBID_REUSEForcefully disconnect after completing the interaction, and cannot be reused.
CURLOPT_FRESH_CONNECTForce a new connection to be obtained instead of the connection in the cache.
CURLOPT_FTP_USE_EPRTWhen enabled, it will use the EPRT (or LPRT) command when downloading FTP. Set toFALSEDisable EPRT and LPRT, use PORT command when enabled.            only.
CURLOPT_FTP_USE_EPSVWhen enabled, it will first try the EPSV command before reverting to PASV mode during FTP transmission. Set toFALSEDisable EPSV command when enabled.
CURLOPT_FTPAPPENDWhen enabled, it will append to the file instead of overwriting it.
CURLOPT_FTPASCIICURLOPT_TRANSFERTEXTAlias.
CURLOPT_FTPLISTONLYWhen enabled, it will only list the names of the FTP directories.
CURLOPT_HEADERWhen enabled, it will output the information of the header file as a data stream.
CURLINFO_HEADER_OUTWhen enabled, it will trace the request string of the handle.From PHP 5.1.3 Start available.CURLINFO_The prefix is intentional.
CURLOPT_HTTPGETWhen enabled, it will set the HTTP method to GET, as GET is the default, so it is only used when modified.
CURLOPT_HTTPPROXYTUNNELWhen enabled, it will transmit through an HTTP proxy.
CURLOPT_MUTEWhen enabled, it will restore all modified parameters in the CURL function to their default values.
CURLOPT_NETRCAfter the connection is established, access ~/The .netrc file retrieves username and password information to connect to a remote site.
CURLOPT_NOBODYWhen enabled, it will not output the BODY part in HTML.
CURLOPT_NOPROGRESS

When enabled, it closes the progress bar of curl transmission. The default setting for this option is enabled.

Note:

PHP automatically sets this option toTRUE, this option should only be changed for debugging purposes.


CURLOPT_NOSIGNALWhen enabled, it ignores all signals passed to PHP by curl. This option is enabled by default in SAPI multi-threaded transmission.CURL 7.10is added.
CURLOPT_POSTWhen enabled, it sends a regular POST request, type:application/x-www-form-urlencoded, just like form submission.
CURLOPT_PUTWhen enabled, it allows HTTP to send files, and it must be set at the same timeCURLOPT_INFILEandCURLOPT_INFILESIZE.
CURLOPT_RETURNTRANSFERto return the information obtained by curl_exec() in the form of a file stream, rather than outputting directly.
CURLOPT_SSL_VERIFYPEERAfter disabling, CURL will terminate the verification from the server. UseCURLOPT_CAINFOthe option sets the certificate usageCURLOPT_CAPATHthe option sets the certificate directory            IfCURLOPT_SSL_VERIFYPEER(The default value is2is enabled,CURLOPT_SSL_VERIFYHOSTneeds to be set toTRUEotherwise set toFALSE.Since CURL 7.10is set to default.TRUE. Starting from CURL 7.10Start the default binding installation.
CURLOPT_TRANSFERTEXTEnabling it uses ASCII mode for FTP transfers. For LDAP, it retrieves plain text information rather than HTML. On Windows systems, the system does not treatSTDOUTSet to binary mode.
CURLOPT_UNRESTRICTED_AUTHWhen usingCURLOPT_FOLLOWLOCATIONContinuously append username and password information to the multiple locations in the generated header, even if the domain has changed.
CURLOPT_UPLOADEnabling it allows file uploads.
CURLOPT_VERBOSEWhen enabled, it reports all information, stored inSTDERRor specifiedCURLOPT_STDERRin.

Return value

Returns TRUE on success, or FALSE on failure.

PHP CURL Reference Manual