Daten-Binär-Parameter in cURL
Ich muss Daten-Binär-Parameter über CURL in PHP senden.
Dies ist der Befehl: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 der Konsole funktioniert das, jetzt muss ich es in PHP machen.
Dies ist der Code, den ich habe:
$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);
Der Anruf wird vom Server angenommen, aber der wird nicht erkanntDaten-ID Parameter:
Keine Daten-ID-Eigenschaft in Auslöser 2010-10-01_15-15-53 definiert
Irgendeine Idee, was ich vermisse?