I'm making a library that allows a user to dynamically add/remove cURL options before a request is made. The foreach loop looks like this:
$ch = curl_init($url);
// Cycle through each option and set them
foreach($setup['curl_options'] as $option => $value)
{
echo '<p>' . $option . ' = ' . $value . '</p>';
curl_setopt($ch, $option, $value);
}
The array key/values display correctly in the paragraphs, however when it comes to adding the values to the curl_setopt, I get the error:
curl_setopt() expects parameter 2 to be long, string given.
What am I doing wrong here?