YouTip LogoYouTip

Func Curl_Setopt_Array

# PHP curl_setopt_array Function [![Image 3: PHP Calendar Reference](#) PHP cURL Reference](#) (PHP 5 >= 5.1.3) curl_setopt_array β€” Batch set options for a cURL transfer session. * * * ## Description bool curl_setopt_array ( resource $ch , array $options ) Batch set options for a cURL transfer session. This function is very useful when you need to set a large number of cURL options, without having to call curl_setopt() repeatedly. * * * ## Parameters **ch** A cURL handle returned by curl_init(). **options** An array used to determine which options will be set and their values. The keys of the array must be valid curl_setopt() constants or their equivalent integer values. * * * ## Return Value Returns TRUE if all options were successfully set. If an option cannot be set, it immediately returns FALSE, ignoring any subsequent options in the options array. * * * ## Example Initialize a new cURL session and fetch a web page. ## Example '', CURLOPT_HEADER =>false); curl_setopt_array($ch, $options); // Grab URL and pass it to the browser curl_exec($ch); // Close cURL resource, and free up system resources curl_close($ch); ?> Prior to PHP 5.1.3, this function could be simulated as follows: Our equivalent implementation of curl_setopt_array() $value) { if (!curl_setopt($ch, $option, $value)) { return false; } } return true; }}?> **Note:** As with curl_setopt(), passing an array to CURLOPT_POST will encode the data as multipart/form-data, while passing a URL-encoded string will encode the data as application/x-www-form-urlencoded. * * PHP cURL Reference](#)
← Func Curl_SetoptFunc Curl_Reset β†’