-1

i have this curlopt_postfields code snippet

CURLOPT_POSTFIELDS =>'{
"No":"893049193012",
"Id":"test_1",
"Token":"jkkhsjkhfkeiuryi"
}'

the question is how to apply these curlopt_postfields on postman? is it as parameter on parameter part? or on body part?

berlin
  • 9
  • 4

1 Answers1

0

You should show your code from postman.
This might help you.

curl  http://example.com -X post --header 'Content-Type:application/json' -d '{"No":"893049193012","Id":"test_1","Token":"jkkhsjkhfkeiuryi"}'

The above converts to:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://example.com');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'post');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type' => 'application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"No":"893049193012","Id":"test_1","Token":"jkkhsjkhfkeiuryi"}');

$response = curl_exec($ch);

When you send JSON in the post data, you need the Content-Type => application/json in the request header.

Misunderstood
  • 5,534
  • 1
  • 18
  • 25