Questions tagged [guzzlehttp]

DO NOT USE THIS TAG it's a duplicate tag, use [guzzle] instead

  • Simple interface for building query strings, POST requests, streaming large uploads, streaming large downloads, using HTTP cookies, uploading JSON data, etc...
  • Can send both synchronous and asynchronous requests using the same interface.
  • Uses PSR-7 interfaces for requests, responses, and streams. This allows you to utilize other PSR-7 compatible libraries with Guzzle.
  • Abstracts away the underlying HTTP transport, allowing you to write environment and transport agnostic code; i.e., no hard dependency on cURL, PHP streams, sockets, or non-blocking event loops.
  • Middleware system allows you to augment and compose client behavior.

To find more information :

268 questions
16
votes
2 answers

Guzzle returns stream empty body instead of json body

When I use Postman to make an API call I receive a JSON object..which is what I expected. However When I make same call with Guzzle like so: $client = new \GuzzleHttp\Client(['base_uri' => 'https://api.dev/']); $response = $client->request('GET',…
Emeka Mbah
  • 13,839
  • 6
  • 61
  • 84
13
votes
1 answer

Guzzle - Laravel. How to make request with x-www-form-url-encoded

I need to integrate an API so I write function: public function test() { $client = new GuzzleHttp\Client(); try { $res = $client->post('http://example.co.uk/auth/token', [ 'headers' => [ 'Content-Type' =>…
Aleks Per
  • 1,181
  • 4
  • 22
  • 53
10
votes
5 answers

Guzzle Pool : Wait for Requests

Is it possible to make the Guzzle pool wait for requests? Right now I can add requests to the pool dynamically, but as soon as the pool is empty, guzzle will stop (obviously). This is a problem when I'm doing 10 or so pages concurrently, because my…
user429620
9
votes
3 answers

posting to endpoint to get the redirect url before purchase

I'm trying to create a custom omnipay driver for a local gateway called creditguard. For this gateway you need to post the data to the endpoint and get back a redirect url for the payment form. My question is how do you post and get the response…
nirz
  • 237
  • 3
  • 8
8
votes
2 answers

How to add headers in Guzzle http

I'm building a small application in Laravel 5.5 where I'm using Guzzle Http to get call the api url and get the response, Few of the api calls have certain condition to have headers which works as authorization of the request generated. I'm trying…
rajesh
  • 165
  • 2
  • 2
  • 19
6
votes
3 answers

Laravel Unresolvable dependency resolving [Parameter #0 [ $method ]] in class GuzzleHttp\Psr7\Request

When posting form I am getting this exception "Unresolvable dependency resolving [Parameter #0 [ $method ]] in class GuzzleHttp\Psr7\Request" Searched and tried many ways to solve this but no progress. Seems that my problem is same as this…
Ansib Raza
  • 298
  • 1
  • 3
  • 9
6
votes
2 answers

Laravel Class 'App\Http\Controllers\GuzzleHttp\Client' not found

I've installed the client and I did an update using composer dump autoload but I still end up with the same error. After installing via composer require guzzlehttp/guzzle:~6.0 in the projects directory. $client = new GuzzleHttp\Client(); Why isn'…
Ted Heath
  • 250
  • 2
  • 5
  • 12
6
votes
2 answers

Mock response and use history middleware at the same time in Guzzle

Is there any way to mock response and request in Guzzle? I have a class which sends some request and I want to test. In Guzzle doc I found a way how can I mock response and request separately. But how can I combine them? Because, If use history…
xAoc
  • 3,018
  • 3
  • 18
  • 33
4
votes
1 answer

cURL error 6: Could not resolve host: test.example.localhost (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) in

I am trying to curl to my localhost laravel site. I am using XAMPP 7.1 When I try to reconnect this code always gives an error (instead of 200 OK response) Fatal error: Uncaught GuzzleHttp\Exception\ConnectException: cURL error 6: Could not resolve…
Yves Gonzaga
  • 105
  • 1
  • 2
  • 12
4
votes
4 answers

Composer fails to install laravel/socialite 2.0

composer require laravel/socialite ^2.0 is failing with below error: Your requirements could not be resolved to an installable set of packages. Problem 1 - Installation request for laravel/socialite 2.0 -> satisfiable by…
4
votes
1 answer

GuzzleHTTP how to get Request Header

I want to print out the request header of a POST request, but I can't find the answer by searching the web. Can someone explain how to do this? I have this array that I pass in the POST request as $value. I want to see how it's parsed in the…
4
votes
1 answer

Class 'GuzzleHttp\HandlerStack' not found

I'm trying to run LaunchDarkly and within the code it says that I need to initialize my class like so $client = new LDClient("MY_CLIENT_KEY"); Now I was able to do that but an error occured below is the error The error is within this code $stack =…
MadzQuestioning
  • 1,980
  • 5
  • 26
  • 54
3
votes
4 answers

GuzzleHttp\Client don't return any response

i'm creating an authentication api using passport from the official docs but i'm stuck on sending GuzzelHttp request i'v done exactly like the docs but when i want to test with postman no result returned it just stay loading without end this is my…
Amor.o
  • 361
  • 4
  • 16
3
votes
2 answers

Error logging is truncated in Laravel of Guzzle http

Guzzle http is truncating exceptions with more than 120 characters, but I need to log the full exception message. How can I do this? I am using laravel 4.2.22.
Parvez Alam
  • 120
  • 2
  • 11
3
votes
3 answers

Guzzle in laravel keeps loading, not returning values

Im using Laravel passport for API authentication. I have two routes /api/login and /oauth/token Since I cannot hardcode my client id and the login receives from JS and the params and client id is hardcoded inside a login…
The Keeper
  • 341
  • 3
  • 14
1
2 3
17 18