如何通过吃惊的优先请求得到客户端的重定向?

时间:2020-10-22 17:13:44

标签: guzzle

如何通过吃惊的优先请求得到客户的重定向?

screnshoot

我已经将参数allow_redirects设置为false,但仍然可以重定向我的请求。

$client = new \GuzzleHttp\Client([
  'headers' => [
    'User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36',
  ], 'verify' => false
]);
$response = $client->post(
  "{$value->url}/wp-json/apg/v1/webhooks",
  [
    'form_params' => [
      'token_auth'   => $this->setting->token_auth,
      'webhooks_type'=> 'theme',
      'theme'        => $theme,
      'url_download' => url('/storage/themes')
    ],
    'allow_redirects' => FALSE
  ]
);
$jsonResponse = json_decode($response->getBody()->getContents());

0 个答案:

没有答案