2, 'name' => 'Customer Name', 'email' => 'customer@example.com' ], JSON_THROW_ON_ERROR); $curl = curl_init('https://starbonding.com/api/v1/create.account.php'); curl_setopt_array($curl, [ CURLOPT_POST => true, CURLOPT_POSTFIELDS => $body, CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 30, CURLOPT_HTTPHEADER => [ 'X-API-Key: ' . $apiKey, 'Idempotency-Key: create-customer-0001', 'Content-Type: application/json' ] ]); $response = curl_exec($curl); if ($response === false) { fwrite(STDERR, curl_error($curl) . "\n"); exit(1); } $status = curl_getinfo($curl, CURLINFO_RESPONSE_CODE); curl_close($curl); echo "HTTP $status\n$response\n"; $result = json_decode($response, true, 512, JSON_THROW_ON_ERROR); exit($status >= 200 && $status < 300 && ($result['success'] ?? false) === true ? 0 : 1);