Skip to content
Advertisement

Passing values while using php curl

I am trying to request an API which has the following details:

Request Headers:

JavaScript

Request Body:

JavaScript

my current code is as follows:

JavaScript

I am not getting the message part correct in payload like adding isHSM, type etc..

My current code is:

JavaScript

Requesting help on how to add the message payload in above curl request…

Advertisement

Answer

You need to pass an array into CURLOPT_POSTFIELDS to make it automatically application/x-www-form-urlencoded. Just remove the http_build_query() function and the appropriate header. The method to POST is also auto set.

JavaScript

The message may be required to be converted into a JSON string.

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement