vendor/maxmind/web-service-common/src/WebService/Http/CurlRequest.php

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php

declare(strict_types=1);

namespace MaxMind\WebService\Http;

use MaxMind\Exception\HttpException;

/**
 * This class is for internal use only. Semantic versioning does not not apply.
 *
 * @internal
 */
class CurlRequest implements Request
{
    /**
     * @var \CurlHandle
     */
    private $ch;

    /**
     * @var string
     */
    private $url;

    /**
     * @var array
     */
    private $options;

    public function __construct(string $url, array $options)
    {
        $this->url = $url;
        $this->options = $options;
        $this->ch = $options['curlHandle'];
    }

    /**
     * @throws HttpException
     */
    public function post(string $body): array
    {
        $curl = $this->createCurl();

        curl_setopt($curl, \CURLOPT_POST, true);
        curl_setopt($curl, \CURLOPT_POSTFIELDS, $body);

        return $this->execute($curl);
    }

    public function get(): array
    {
        $curl = $this->createCurl();

        curl_setopt($curl, \CURLOPT_HTTPGET, true);

        return $this->execute($curl);
    }

    /**
后面还有 76 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。