Search code examples
phpguzzleamazon-clouddrive

GuzzlePHP Request Query String


I'm working on an application using Amazon's CloudDrive SDK. When requesting a list of folders or files, you can send filters in the query string, but the values of each filter needs to have special characters escaped (included spaces, much like a Linux command line argument). I'm not entirely sure how to send the string through Guzzle (or PHP in general) so that its interpreted by the API as escaped strings.

If I use 'addcslashes' and define all the characters necessary, the API returns with Invalid filter:name:Test\, but if I simply cURL the same endpoint, it returns the proper data.

When using addcslashes in PHP, the request value ends up being "name:Test\ Folder AND kind:FOLDER". But as I said, this fails up at the endpoint.

Thanks for any help in advance!


Solution

  • So I posted this question after a day or so of messing around with the issue with no resolution and immediately after posting, I tried another method that seemed to solve my issue...

    In the Guzzle library ,setting the Encoding type of the request to RFC1738 seemed to fix the issue and return the proper data. Although, I still needed to call addcslashes on the value.