以params guzzle http形式发送url

问题描述 投票:0回答:1

我使用laravel和GuzzleHttp进行与以下相同的发送帖子请求

$client = new Client(['verify' => false]);

$data = [
   'headers' => [
                    'Authorization' => 'code',
                    'Content-Type' => 'application/x-www-form-urlencoded',
                ],
  'form-params' => [
                        'redirect_uri' => 'http://localhost',
                        'code' => 'MZTADnFF6m'
                ]
        ];

  $response = $client->request('POST', 'https://oom.com', $data);

但是我的问题是'http://localhost'作为'http:\/\/localhost'发送到api服务器

我该如何解决这个问题?

php laravel curl guzzle
1个回答
0
投票

使用urlencode这是


'redirect_uri' => urlencode('http://localhost'),

© www.soinside.com 2019 - 2024. All rights reserved.