curl pass raw json in post request
If you wanna use Content-type: application/json and raw data, seem your data
should be in json format
$ch = curl_init();
$headers = [
'x-api-key: XXXXXX',
'Content-Type: text/plain'
];
$postData = [
'data1' => 'value1',
'data2' => 'value2'
];
curl_setopt($ch, CURLOPT_URL,"XXXXXX");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($postData));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec ($ch);
$statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
Also in JavaScript:
- react native onChangeText resize the background image
- property 'name' does not exist on type 'eventtarget' react
- html video tag autoplay not working
- nodejs fs directory exists
- hoe lang is 50000 uur
- es6 method definition syntax
- js array add element
- react dictionary key value avec 2 variable
- javascript go to page
- change array index position in javascript by up and down click
- angular download blob pdf
- example use xor in
- forjs check if key in json
- foreach async typescript
- js when you leave
- how to create a javascript hello world program with node.js
- how to convert a number to a string in javascript
- v-for vuejs
- discord js bot leave voice channel
- node read file sync
- for loop js example
- multiple ckeditor on same page
- unterminated character class react native
- angular material theme colors