true, CURLOPT_RETURNTRANSFER => true, CURLOPT_CONNECTTIMEOUT => 5, CURLOPT_TIMEOUT => 20, CURLOPT_HTTPHEADER => ['Content-Type: application/json', 'Authorization: Bearer ' . getenv('PETROSUPPORT_TOKEN'), 'Idempotency-Key: ' . getenv('PETROSUPPORT_IDEMPOTENCY_KEY')], CURLOPT_POSTFIELDS => $body]); $response = curl_exec($ch); if ($response === false) { throw new RuntimeException('Transport failed; reconcile before retrying.'); } $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if ($status >= 300) { throw new RuntimeException("API returned HTTP $status: $response"); } echo $response;