showing results for - "curl pass raw json in post request"
Luana
18 Jan 2017
1If you wanna use Content-type: application/json and raw data, seem your data 
2should be in json format
3
4$ch = curl_init();
5$headers  = [
6            'x-api-key: XXXXXX',
7            'Content-Type: text/plain'
8        ];
9$postData = [
10    'data1' => 'value1',
11    'data2' => 'value2'
12];
13curl_setopt($ch, CURLOPT_URL,"XXXXXX");
14curl_setopt($ch, CURLOPT_POST, 1);
15curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
16curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($postData));           
17curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
18$result     = curl_exec ($ch);
19$statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
queries leading to this page
curl post json datacurl send json postcurl body raw jsonuse curl to raw json datasend json data using post req using curlcurl pass post datapost json data using curlphp curl pass json query param post apicurl post request pass data curl to send json data in request bodycurl raw json bodycurl post json bodycurl post example with json bodycurl post request with json bodycurl pass raw json in post requestcurl send to raw bodycurl post request raw responsepass json body in curlcurl post 22 data raw 22how to send json in body of request php curlcurl post raw datapost data raw curlcurl how to send json in postcurl post body data rawpost raw json in php curlcurl send post data as body requestcurl post with json bodycurl post request raw datacurl post data rawcurl post data jsonsend json in post request curlpassing json data in curlcurl post with data jsonpass raw json data on curl phpcurl call pass json stringphp curl send post data with body as rawhow to post raw body data with curlpass json from curlcurl send raw jsonadd json body data to curl requestsend raw json and file in curl request postcurl send post json parameterphp curl post raw jsoncurl post get json data curl data raw to jsoncurl post send body datasend raw json form curlcurl raw postphp curl post raw json datacurl raw json datacurl send post request with json bodycurl pass json datacurl data raw jsonphp curl send post data as jsoncurl pass json as bodycurl post body jsoncurl pass jsonpass json in curlcurl rawdata jsoncurl request with json bodyphp curl post send raw datacurl post raw dataphp curl send post data in jsonpass a json file as argument with curl requestphp curl send body rawcurl pass json object as datacurl post data from json filecurl json data postcurl post raw jsoncurl pass raw json in post request