php - cURL with PUT method -


is possible curl request put method using url? here url able call using curl put method:
$url = https://url.net/card/activate.xml?card_id=1234567890&application_key=123123&accesskey=abcdef

i able make work using rest console(chrome extension) not using curl. tried using curl_setopt curlopt_put, curlopt_infile , curlopt_infilesize receiving empty page, no response @ all.

this headers , curl options have:

$header[] = 'authorization: basic abc123'; $header[] = 'accept: text/xml';  curl_setopt($curl, curlopt_customrequest, 'put'); curl_setopt($curl, curlopt_url, $url); curl_setopt($curl, curlopt_httpheader, $header); curl_setopt($curl, curlopt_ssl_verifyhost, false); curl_setopt($curl, curlopt_ssl_verifypeer, false); curl_setopt($curl, curlopt_returntransfer, true);  $output = curl_exec($soap_do); 

currently, settings, i'm getting 411 length required error. possible make work or trying configure never work?

the http 411 error

the web server (running web site) thinks http data stream sent client (e.g. web browser or our checkupdown robot) should include 'content-length' specification. typically used http methods result in placement of data on web server, not retrieval of data it.

you need set content length of data

$header[] = 'content-length: '.strlen($put_data); 

or if don't have data, put 0 there.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -