Skip to content
Advertisement

Tag: guzzle

Prevent Guzzle from creating a 500 error on non 200 response

On my website I use Guzzle to report hacking attempts to AbuseIPDB. For example, when a hacker visits /.env a report will automatically get filed. AbuseIPDB gives a 429 when you send more than one report for the same IP. Guzzle then gives a 500 error as AbuseIPDB did not give a 200 OK. My question is, how can I

Catch HTTP client errors in Laravel 8

How do you catch errors thrown by the HTTP client (for example a time out) so that it doesn’t throw the curl error in the Laraval debugger (in debug mode) before you can do anything with the error to avoid stopping the execution? Instead, I’m always getting the Laravel’s Ignition error page and the error is not caught by my

Convert PHP HTTP request to Guzzle

I currently have an old PHP page which carries out a post request to an external API but i am wanting to convert this to Guzzle to tidy it up but im not sure if im on the right lines with this. PHP …

Guzzle getContents()->getBody() – Second calls return empty string

I’m calling an API via Guzzle. My json test (outputted from “1”) is But, in code “2” I have an empty string and in code “3” (output from “checkError” method) I have null. If I comment out the checkError method, I would expect another time same json in fragment 2, but I have an empty string. Why this behaviour? Answer

Decoding a gzipped string in PHP

I am trying to decode a gzipped body of a REST response (YouTrack-API) with PHP. Nothing seems to work: Automatic decoding from CURL does nothing Using Guzzle with headers set to accept encoding does nothing Simply putting the acquired string into gzdecode() does nothing I have tried gzinflate, gzdecode and some wild combinations of them including stripping off bytes at

Advertisement