Questions tagged [guzzle]

Guzzle, a versatile PHP HTTP client, simplifies sending HTTP requests and seamlessly connects with various web services. It is compatible with cURL, PHP's stream wrapper, sockets, as well as non-blocking libraries such as React.

Using Guzzle to Make a JSON POST Request in Laravel 5.7

I need help with my code. I am trying to create a new store in Geoserver. public function post_store(String $name) { $client = new Client(); $res = $client->request('POST', 'http://localhost:8080/geoserver/rest/workspaces/&a ...

Getting the initial body back after encountering an HTTP error using Guzzle

I'm currently sending a Guzzle request to an API, and $request = $this->client->request('GET', 'https://etc', ['http_errors' => false]); Due to the API responding with a JSON message along with a 402 header co ...

Laravel 5: How to retrieve the Status Code from Guzzle Exception?

I'm currently working on a personal application project where I need to make requests to various websites using the Guzzle package. One specific requirement I have is to log every request in my database, including the time of the request, the duration, an ...

Tips for leveraging dynamic user-agent header with PHP Curl or Guzzle Client

I am brand new to PHP and I am currently exploring how to call a REST Service. To achieve this, I have the option of using either Curl or Guzzle Client in PHP. After setting it up, I tested calling the service from Mozilla and Chrome Browsers. However, I ...

Ways to make asynchronous requests with guzzle without relying on a proxy server

I am attempting to send 100 asynchronous requests to the Instagram website using PHP Guzzle as shown below: $client = new Client(); $promises = []; for($i = 1; $i <= 100; $i++) { $options = ['timeout' => 60]; $promise = $client-&g ...

Steps for clearing cache and resetting a Guzzle client to free up memory usage:

I am currently facing an issue with my code, which involves making multiple calls to the same site using Guzzle in order to check for the existence of a document. Each call results in an increase in memory usage, eventually leading to memory exhaustion whe ...

Implementing authentication in GuzzleHTTP Request Objects for improved asynchronous processing

In my project, I am generating multiple GuzzleHttpPsr7Requests as shown below: use GuzzleHttpPsr7Request; $myRequest = new Request( 'GET', $someUri ); All these requests are stored in an array called $guzzleRequests. To handle all the reque ...

Making a Guzzle 6 API call using a POST method

Can anyone help me figure out how to send multiple data with a POST request? Here's what works: $data = array( 'post_params'=>[ 'Name'=>'Foo', 'LastName'=>'Bar' ] ); But when I try this, it doesn't work. Any suggestions? $data = array( 'pos ...

Query parameters in Guzzle HTTP client requests

Looking to transition a method from GuzzleHttp to using a pool that implements the Request method. <?php use GuzzleHttp\Client; $params = ['password' => '123456']; $header = ['Accept' => 'application/xml&ap ...

Executing an authenticated Guzzle POST request

Just starting out with guzzle and I need help on how to make a Guzzle call for this specific request. curl -X POST -u username:password -H "Content-Type: application/json" https://xyz/api/v1/accounts.json -d '{"user":{"username":"test","password":"xyz","f ...