I am making a cURL request via Kohana 3.2 but I get the following error when it tries to access CURLOPT_POST
constant:
Use of undefined constant CURLOPT_POST - assumed 'CURLOPT_POST'
From Kohana 3.2 system/classes/kohana/request/client/curl.php
public function _set_curl_request_method(Request $request, array $options)
{
switch ($request->method()) {
case Request::POST:
$options[CURLOPT_POST] = TRUE;
break;
case Request::PUT:
$options[CURLOPT_PUT] = TRUE;
break;
default:
$options[CURLOPT_CUSTOMREQUEST] = $request->method();
break;
}
return $options;
}
My application code:
$request = Request::factory($uri);
$request->query('key', $key);
$request->post($params);
$request->method(Request::POST);
// fails here
$response = $request->execute();
I have tested that curl is active as an extension using:
if (in_array ('curl', get_loaded_extensions()))
{
echo '1';
}
else
{
echo '0';
}
What is the problem here? I am using Windows 7, PHP 5.4.12, and Apache 2.4.
CURLOPT_POST
? – Fellnerundefined function curl_....
if the curl extension isn't available? If not (or unsure) better double-check via phpinfo(), extension_loaded('curl'), ... – Gromme$request = Request::factory($url)->method('POST')->post('key', 'value');
– Im