使用枪口而不是卷曲后的字段

时间:2018-12-04 10:17:29

标签: api curl guzzle

我想用食糖代替卷发,但是在食糖中,我总是收到不好的要求。

我的卷曲选项正在起作用

$aOptions = [
                    CURLOPT_URL            => self::TOKEN_URL . "clientid/vendorid",
                    CURLOPT_RETURNTRANSFER => 1,
                    CURLOPT_POSTFIELDS     => "vendorid=" . $this->apiConfiguration->getVendorId(),
                    CURLOPT_POST           => 1,
                ];

这是我的“卷曲请求”,在此我总是收到“错误请求”

    $client = new Client([
        'base_uri' => self::TOKEN_URL,
    ]);
    $options = [
        'debug' => true,
        'form_params' => [
            'vendorid' => $this->apiConfiguration->getVendorId(),
        ],
        'headers' => [
            "Content-Type" => "application/x-www-form-urlencoded",
            "Authorization" => "Basic " . $this->apiConfiguration->getAuthorization(),
        ]

    ];
    $response = $client->post('clientid/vendorid', $options);

我不确定,这是否是使用食尸鬼的正确/最佳方法。

0 个答案:

没有答案