$value) { $baseHeaders[] = $key . ': ' . $value; } curl_setopt_array($ch, [CURLOPT_POST => true, CURLOPT_HTTPHEADER => $baseHeaders, CURLOPT_POSTFIELDS => json_encode($payload), CURLOPT_RETURNTRANSFER => true]); $body = curl_exec($ch); if ($body === false) { throw new Exception(curl_error($ch)); } curl_close($ch); return json_decode($body, true); } $token = post_json($identityUrl, ['clientId' => getenv('DECISIOQ_CLIENT_ID'), 'clientSecret' => getenv('DECISIOQ_CLIENT_SECRET'), 'audience' => $audience])['jwtToken']; $ch = curl_init($catalogUrl . '/decisioncatalog/decisions/AUTO-TOW-047'); curl_setopt_array($ch, [CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $token], CURLOPT_RETURNTRANSFER => true]); curl_exec($ch); curl_close($ch); $payload = json_decode(file_get_contents(__DIR__ . '/../auto-tow-047-execute.json'), true); $result = post_json($decisionServiceUrl . '/api/v1/decide', $payload, ['Authorization' => 'Bearer ' . $token, 'X-Correlation-Id' => 'auto-tow-047-demo-001']); echo json_encode($result, JSON_PRETTY_PRINT), PHP_EOL; ?>