I am trying to send data to a web api. By doing so, I have created button into my edit form to send this data. This button invokes a procedure which is doing the put request to the related api. If I am doing this update directly in command line with curl, it works. Here is the procedure
Code: Select all
$params=['mesures'=>'updated']; // assigning updated to mesures fields
//$params=['mesures=updated'];
$defaults = array(
CURLOPT_URL => 'http://localhost/api/mesures/1',
CURLOPT_PUT => true,
CURLOPT_POSTFIELDS => http_build_query($params),
);
$ch = curl_init();
curl_setopt_array($ch, ($defaults));
//curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
curl_close ($ch);