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
Tag: guzzle
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 …
“file_get_contents(http://127.0.0.1:8000/storage/config/xxx.ini): failed to open stream: HTTP request failed! ”
I got this error message when trying to send form data post request via POST method. “file_get_contents(http://127.0.0.1:8000/storage/config/xxx.ini): failed to open stream: HTTP request failed! ” …
What is the correct way to read a large JSON API response in Guzzle 6?
I currently have the following Guzzle 6 implementation returning a stream of JSON data containing user data: $client = new GuzzleHttpClient([ ‘base_uri’ => ‘https://www.apiexample.com’, …
How can I get response from guzzle in Laravel 5.3
I try like this : $client = new Client(); $res = $client->request(‘POST’, ‘https://api.orange.com/smsmessaging/v1/outbound/tel:+phone/requests/’, [ ‘headers’ => [ ‘…
Swagger basic authentication fails with php client
When I try to use the generated php client from a yaml file it doesn’t seem to work. I get a authentication error even though I had filled in the configuration for the authentication. But when I …
Issues instantiating class in composition project
So I have a task to access an external api and then render the results to a separate FE. I have made an ApiClass and a ProductListClass. Then from an index page I am including the two class files and …
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