You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Brian Boll edited this page Apr 23, 2018
·
3 revisions
CurlMultiHandler :: setOptions(array)
$options = array(
CURLOPT_URL => "this_is_not_a_valid_URL",
CURLOPT_USERAGENT => "EXAMPLE_USERAGENT",
CURLOPT_POST => false,
CURLOPT_RETURNTRANSFER => true
);
//Construct the multi handler object$mch = newCurlMultiHandler();
//Construct various handles to be handled by the multi handler object$ch1 = newCurlHandler('http://example.com');
$ch2 = newCurlHandler('http://google.com');
$ch3 = newCurlHandler('http://google.com');
//Add the first two handles$mch->addHandle($ch1);
$mch->addHandle($ch2);
//Sets options (including URL change) for currently added handles: $ch1, $ch2$mch->setOptions($options);
//None of the above options apply to this handle since it was added after$mch->addHandle($ch3);
$mch->execute();
var_dump($mch->getError());
The $ch1 and $ch2 handles will both return errors "Couldn't resolve host name" on URL "this_is_not_a_valid_URL".
Note:$ch3 request will not have a user agent, post or return transfer set
Parameters [1]:
[1]array: An array containing constants as keys each representing one of the libcurl options detailed more here and their corresponding expected values