Мне нужно отправить двоичный параметр данных через cURL в php.
Это команда: curl -D - -u user:password -X PUT -H "Content-Type: text/plain" --data-binary "data-id=2010-10-01_15-15-53" https://someurl
. В консоли это работает, теперь я должен сделать это в php.data-binary parameter в cURL
Это код, у меня есть:
$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);
вызов принят сервером, но он не признает данных ID параметр:
Нет данных ID имущество, определенное в триггере 2010-10-01_15-15-53
Любая идея, что мне не хватает?
ли вы понять это ? – NCoder
@NCoder nope :( – OSdave
Я предполагаю, что это для интеграции surescripts. У вас есть базовая настройка соединения с ними для отправки и получения базового запроса с CURL/PHP? – NCoder