curl_setopt (PHP 4 >= 4.0.2, PHP 5) curl_setopt -- Set an option for a CURL transfer Descriptionbool curl_setopt ( resource ch, int option, mixed value )
Set an option for a CURL session identified by the
ch parameter. option
specifies which option to set, and
value specifies the value for the option given.
value should be a bool for the
following values of the option parameter:
value should be an integer for the
following values of the option parameter:
value should be a string for the
following values of the option parameter:
value should be an array for the
following values of the option parameter:
value should be a stream resource (using
fopen(), for example) for the following values of the
option parameter:
value should be a string that is the name of a valid
callback function for the following values of the
option parameter:
Example 1.
Initializing a new CURL session and fetching a webpage
<?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);
// close CURL resource, and free up system resources curl_close($ch); ?>
|
|
|
|