3

in this code :

$customer = \GuzzleHttp\Client(['base_uri'=>'https://example.com']);
$response = $customer->request('GET', '/', ['query'=> ['name'=>'Dolce| Gabana']]);

All is correct except the parameter of the query is urlencoded

https://example.com/?name=Dolce%7CGabana

I want exactly this request uri

https://example.com/?name=Dolce|Gabana

How to resolve this problem ?

Goms
  • 2,424
  • 4
  • 19
  • 36

2 Answers2

0

I am having the exact same issue.

The solution I've found so far is to write the query manually... Following your example, it should be something like this:

$customer = \GuzzleHttp\Client(['base_uri'=>'https://example.com']);
$response = $customer->request('GET', '/?name=Dolce|Ganana');
beitomartinez
  • 53
  • 2
  • 8
-1

The url encoding should remain. The url often contains characters that are outside ASCII set and therefore it needs to be converted to ASCII. That is why it is escaped with %.

Guzzle urls aren't visible to the user I don't understand why you see problem in it.

Robert
  • 19,800
  • 5
  • 55
  • 85
  • Account Kit API need a url like `https://graph.accountkit.com/'.$version.'/access_token?'. 'grant_type=authorization_code'. '&code='.$_POST['code']. "&access_token=AA|$app_id|$secret";` – Goms Jan 12 '18 at 09:53
  • I'm sure they do urldecode and it will become "|" afterwards – Robert Jan 13 '18 at 23:35