Это данные, которые необходимо отправить с запросом
Я обычно заключаю это в функцию, чтобы упростить обработку ошибок / успеха. Особенно, если вы имеете дело с API, таким как PayPal или что-то
// create the object (you can do this via a string if you want just remove the json encode from the postfields )
$request = new stdClass(); //create a new object
$request->input = new stdClass(); // create input object
$request->input->urn = 'num'; // assign values
$request->input->compressedUrn = true;
$request->input->rootFilename = 'A5.iam';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'URL HERE');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode( $request ) ); // encode the object to be sent
curl_setopt($ch, CURLOPT_POST, true); // set post to true
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [ //set headers
'Content-Type: application/json',
'Authorization: Bearer x'
]);
$result = curl_exec ($ch);
if ( ! $result) { //check if the cURL was successful.
// do something else if cURL fails
}
curl_close ($ch);
$return = json_decode( $result ); // object if expecting json return