Reputation: 1477
im trying to make a request in a remote xml file, and i receive a response from the server saying:
"Access denied, only compressed data can be send"
So i try using in my request:
$guzzleClient = new Client();
$feed_response = $guzzleClient->request('GET', $url,[
'headers' => [
'Accept-encoding: gzip'
],
'debug' => true
]);
echo $feed_response->getStatusCode();
But it doesnt work, it gives me the same error, but if i use a example using curl:
curl -sH 'Accept-encoding: gzip' "domain/xmlfile" --compressed
It works fine, can someone tell me what is missing on the guzzle options?
Upvotes: 0
Views: 396
Reputation: 1477
The solution was:
$feed_response = $guzzleClient->request('GET', $url,[
'headers' => ['Accept-Encoding' => 'deflate, gzip'],
// 'debug' => true
]);
Upvotes: 1