Hi all,
I'm able to run the following curl command (at the command line) successfully:
curl -XPOST --basic -u user:password -H accept:application/json -H Content-type:application/json --data-binary '{ "@queryid" : 1234 }' http://localhost/rest/run?10
Here is what I'm doing so far however it doesn't seem to be working with the REST service I'm using:
<?php
$headers = array(
'Accept: application/json',
'Content-Type: application/json',
);
$url = 'http://localhost/rest/run?10';
$query = '{ "@queryid" : 1234 }';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "user:password");
curl_setopt($ch, CURLOPT_PUT, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $query);
curl_setopt($ch, CURLOPT_POSTFIELDSIZE, strlen($query));
$output = curl_exec($ch);
echo $output;
?>
What is the correct way when trying to convert --data-binary using a PUT method?
Thanks!