true, CURLOPT_POSTFIELDS => http_build_query([ 'key' => $apiKey, 'action' => 'services', ]), CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 20, CURLOPT_HTTPHEADER => ['Content-Type: application/x-www-form-urlencoded'], ]); $response = curl_exec($client); if ($response === false) { throw new RuntimeException(curl_error($client)); } $status = curl_getinfo($client, CURLINFO_HTTP_CODE); curl_close($client); if ($status < 200 || $status >= 300) { throw new RuntimeException('API returned HTTP ' . $status . ': ' . $response); } $data = json_decode($response, true, 512, JSON_THROW_ON_ERROR); print_r($data);