lundi 25 décembre 2017

GuzzleHttp disable UrlEncoding

I should send some JSON in my Get request and the server returns some data in application/json as response:

$url='http://ift.tt/2BNkckC{'id':123,satrt:342,end:987,using:"abc"}';

and I use this code:

$client = new \GuzzleHttp\Client;
$response = $client->get($url);
$data = json_decode((string)$response->getBody(), true);

but it send a request to:

 http://ift.tt/2BwUhJv'id':123,satrt:342,end:987,using:"abc"%7D

I see this answer about $response->getQuery()->useUrlEncoding(false) but it do nothing.

how can I tell GuzzleHttp not to url encode the { and }?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire