curl_setopt
curl_setopt
Set an option for a cURL transfer
bool **curl_setopt** CurlHandle $handle int $option mixed $value
Sets an option on the given cURL session handle.
option
The option to set.
CURLOPT_*
value
The value to be set on .
See the description of the
constants
for details on the type of values each constant expects.
option``CURLOPT_*
return.success
Voorbeeld: Initializing a new cURL session and fetching a web page
<?php
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "http://www.example.com/");
curl_setopt($ch, CURLOPT_HEADER, false);
// grab URL and pass it to the browser
curl_exec($ch);
?>
Opmerking: > Passing an array to will encode the data as , while passing a URL-encoded string will encode the data as .
CURLOPT_POSTFIELDSmultipart/form-data**application/x-www-form-urlencoded
curl_setopt_array``CURLFile``CURLStringFile