Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP curl_multi_setopt Function

PHP curl_multi_setopt Function

PHP Calendar Reference Manual PHP cURL Reference Manual

(PHP 5 >= 5.5.0)

curl_multi_setopt — Set an option for a cURL multi transfer.


Description


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

Sets an option for a cURL multi transfer.


Parameters

** ch**

A cURL handle returned by curl_init().

** option **

The CURLOPT_XXX option to set.

value

The value to set on the option.

For the following options, value should be set to a bool:

Option OptionalvalueValue Notes
CURLOPT_AUTOREFERER When following a *Location:redirect, automatically set theReferer:* information in the header.
CURLOPT_BINARYTRANSFER WhenCURLOPT_RETURNTRANSFERis enabled, returns the raw output.
CURLOPT_COOKIESESSION When enabled, cURL will only pass a session cookie and ignore other cookies; by default cURL sends all cookies back to the server. A session cookie is one that exists to determine whether the server-side session is valid.
CURLOPT_CRLF When enabled, converts Unix newlines to carriage return + newline.
CURLOPT_DNS_USE_GLOBAL_CACHE When enabled, enables a global DNS cache; this is thread-safe and enabled by default.
CURLOPT_FAILONERROR Displays the HTTP status code; by default, HTTP information with a code less than or equal to 400 is ignored.
CURLOPT_FILETIME When enabled, tries to modify the information in the remote document. The resulting information is returned via theCURLINFO_FILETIMEoption of the curl_getinfo() function.
CURLOPT_FOLLOWLOCATION When enabled, recursively sends the *"Location: "* returned by the server back to the server in the header; useCURLOPT_MAXREDIRSto limit the number of recursive redirects.
CURLOPT_FORBID_REUSE Forces the connection to close after the interaction is complete, so it cannot be reused.
CURLOPT_FRESH_CONNECT Forces a new connection instead of using a cached one.
CURLOPT_FTP_USE_EPRT When enabled, uses the EPRT (or LPRT) command for FTP downloads. Set toFALSEto disable EPRT and LPRT and use the PORT command only.
CURLOPT_FTP_USE_EPSV When enabled, tries the EPSV command first before falling back to PASV mode during FTP transfers. Set toFALSEto disable the EPSV command.
CURLOPT_FTPAPPEND When enabled, appends to the file instead of overwriting it.
CURLOPT_FTPASCII CURLOPT_TRANSFERTEXTis an alias of.
CURLOPT_FTPLISTONLY When enabled, lists only the names in an FTP directory.
CURLOPT_HEADER When enabled, outputs header information as part of the data stream.
CURLINFO_HEADER_OUT When enabled, traces the handle's request string. Available since PHP 5.1.3. The **CURLINFO_** prefix is intentional.
CURLOPT_HTTPGET When enabled, sets the HTTP method to GET; since GET is the default, this is only used when it has been changed.
CURLOPT_HTTPPROXYTUNNEL When enabled, transfers through an HTTP proxy.
CURLOPT_MUTE When enabled, resets all modified parameters in the cURL functions to their default values.
CURLOPT_NETRC After the connection is established, access the~/.netrcfile to obtain the username and password used to connect to the remote site.
CURLOPT_NOBODY When enabled, the BODY part of the HTML is not output.
CURLOPT_NOPROGRESS

When enabled, disables the progress bar for cURL transfers; this option is enabled by default.

Note:

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

| | | **CURLOPT_NOSIGNAL** | When enabled, ignores all signals passed by cURL to PHP. Enabled by default in SAPI multi-threaded transfers. | Added in cURL 7.10. | | **CURLOPT_POST** | When enabled, sends a regular POST request of type *application/x-www-form-urlencoded*, just like a form submission. | | | **CURLOPT_PUT** | When enabled, allows HTTP file uploads; **CURLOPT_INFILE** and **CURLOPT_INFILESIZE** must also be set. | | | **CURLOPT_RETURNTRANSFER** | Returns the information fetched by curl_exec() as a string instead of outputting it directly. | | | **CURLOPT_SSL_VERIFYPEER** | When disabled, cURL stops verifying the peer. Use **CURLOPT_CAINFO** to set the certificate and **CURLOPT_CAPATH** to set the certificate directory. If **CURLOPT_SSL_VERIFYPEER** (default value 2) is enabled, **CURLOPT_SSL_VERIFYHOST** must be set to **TRUE**, otherwise set it to **FALSE**. | Defaults to **TRUE** since cURL 7.10; bundled by default since cURL 7.10. | | **CURLOPT_TRANSFERTEXT** | When enabled, uses ASCII mode for FTP transfers. For LDAP, it retrieves plain text instead of HTML. On Windows systems, *STDOUT* is not set to binary mode. | | | **CURLOPT_UNRESTRICTED_AUTH** | Keeps appending username and password information across multiple locations in the header produced by **CURLOPT_FOLLOWLOCATION**, even if the domain name changes. | | | **CURLOPT_UPLOAD** | When enabled, allows file uploads. | | | **CURLOPT_VERBOSE** | When enabled, reports all information, stored in *STDERR* or the specified **CURLOPT_STDERR**. | |

Return Value

Returns TRUE on success, or FALSE on failure.


PHP Calendar Reference Manual PHP cURL Reference Manual