Guzzle not stopping data from Redirect:
The following guzzle request not preventing redirects always show status 200 while I have tried with postman it returns 302:
$response = $client->request(
'GET',
$Url,
['query' => $body],
[
'headers' => [
'Content-Type' => 'application/x-www-form-urlencoded'
]
],
['allow_redirects' => FALSE]
);
$responseHomeNetworkAPI = $response;
echo $response->getStatusCode();
As I already said on GitHub, probably because you use request()
method in a wrong way. All your three arrays should be combined into one:
$response = $client->request(
'GET',
$Url,
[
'query' => $body,
'headers' => ['Content-Type' => 'application/x-www-form-urlencoded'],
'allow_redirects' => false
]
);
BTW, Content-Type: application/x-www-form-urlencoded
makes no sense in a GET request.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With