curl post json
curl -X POST -H "Content-Type: application/json" \
-d '{"username":"abc","password":"abc"}' \
https://api.example.com/v2/login
curl post json
curl -X POST -H "Content-Type: application/json" \
-d '{"username":"abc","password":"abc"}' \
https://api.example.com/v2/login
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);
curl post json object command
curl -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"id":100}' http://localhost/api/postJsonReader.do
curl post json file
curl -X POST -H "Content-Type: application/json" -d @../data/cats.json http://localhost:8080/mSfvMwNAfj
curl post
curl -X POST -d "param1=value1¶m2=value2" https://example.com/post
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us