I have to send data-binary parameter through cURL in php.
This is the command: curl -D - -u user:password -X PUT -H "Content-Type: text/plain" --data-binary "data-id=2010-10-01_15-15-53" https://someurl
. In the console this works, now I have to do it in php.
This is the code I have:
$this->_curl = curl_init();
curl_setopt($this->_curl, CURLOPT_USERPWD, $this->_loginUser . ":" . $this->_loginPassword);
curl_setopt($this->_curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($this->_curl, CURLOPT_HEADER, 1);
curl_setopt($this->_curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($this->_curl, CURLOPT_TIMEOUT, 30);
curl_setopt($this->_curl, CURLOPT_URL, $this->_serviceUrl);//https://someurl
curl_setopt($this->_curl, CURLOPT_HTTPHEADER, array('Content-Type: text/plain'));
curl_setopt($this->_curl, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($this->_curl, CURLOPT_POSTFIELDS, array('data-id' => $dataId));//d'2010-10-01_15-15-53'
$response = curl_exec($this->_curl);
//$response = HTTP/1.1 201 Created
curl_close($this->_curl);
the call is accepted by the server, but it doesn't recognize the data-id parameter:
No data-id property defined in trigger 2010-10-01_15-15-53
Any idea what I'm missing?