Questions tagged [guzzle6]

337 questions
4
votes
2 answers

Multiple files uploaded via Guzzle multipart/form-data request are not recognized by Symfony

Environment: Guzzle 6 Symfony 2.3 Uploading multiple files via a Guzzle POST request should be done with a multipart request. So I configure my $options array like so: Array ( [multipart] => Array ( [0] => Array ( …
Worp
  • 948
  • 4
  • 17
  • 30
4
votes
1 answer

guzzle allow redirects false does not work

Guzzle not stopping data from Redirect: The following guzzle request not preventing redirects always show status 200 while I have tried with postman it returns 302: $response = $client->request( 'GET', $Url, ['query' => $body], [ …
Jiten Shahi
  • 41
  • 2
  • 7
4
votes
2 answers

Handle aggregate promise of EachPromise (each_limit) in Guzzle

The task Suppose we have an API POST endpoint which returns answer like this: { "data": [1,2,3], "total_rows": 20 } Which means that we received data partially, only the first page of 3 entries. The total entries count is 20, which means we…
Eduard Sukharev
  • 1,188
  • 2
  • 15
  • 37
4
votes
0 answers

Create connection to Api Oauth 2.0 using Guzzle 6

Scenario Remote APi with Oauth 2.0 App not work on mode web. Only console Using Library Guzzle 2.0 (client) On remote API Documentation HTTPS -> POST https://ops.epo.org/3.2/auth/accesstoken HTTP Headers Authorization- > Basic…
abkrim
  • 3,512
  • 7
  • 43
  • 69
4
votes
1 answer

Guzzle6 error Invalid resource type: array when send a GuzzleHttp\Psr7\Request

I am trying to send a code by using GuzzleHttp\Psr7\Request,somehow I get error Invalid resource type: array, the following is my codes $params = ["name"=>"myName","id"=>"myId"]; $client = new Client(); $request = new…
d3no
  • 121
  • 1
  • 3
  • 12
4
votes
2 answers

Using PHP Guzzle HTTP 6 to send JSON with data that is already encoded

I am trying to send a POST request which contains a raw JSON string with the following header: Content-Type: application/json. From looking at the docs, I can see that I can do something like this... $data = ['x' => 1, 'y' => 2, 'z' => 3]; $client =…
Tom Wright
  • 2,841
  • 4
  • 22
  • 30
4
votes
2 answers

Why I get Fatal error: Uncaught exception 'GuzzleHttp\Exception\ClientException' with message 'Client error: 404'?

I try catch exception, but i still get "Fatal error: Uncaught exception 'GuzzleHttp\Exception\ClientException' with message 'Client error: 404' in C:\OS\OpenServer\domains\kinopoisk\parser\php\vendor\guzzlehttp\guzzle\src\Middleware.php:69"
TheMrbikus
  • 713
  • 2
  • 8
  • 14
4
votes
1 answer

How to not override original guzzle message

I am trying to create a three tier web application : Frontend (AngularJS) "API Exposure Layer" with Symfony2 and Guzzle (6) inspired by these slides by Meetic: http://www.slideshare.net/meeticTech/meetic-backend-mutation-with-symfony built with…
Purplefish32
  • 647
  • 1
  • 8
  • 24
3
votes
1 answer

how to stop retry HTTP call when server servers respond with 200 status codes using guzzle retry middleware?

Following code throws an error "paremeter 4 &$options expected to be a reference, value given" This code is from guzzle_retry_middleware#on-retry-callback I wanted to stop the guzzle retry call after receiving self::STATUS_DRAFT ===…
Safry
  • 191
  • 1
  • 9
3
votes
4 answers

Laravel 5.6 Mock Guzzle Response

I am trying to mock a guzzle response from a specific api. My controller code looks like this (amended for brevity): class SomeClass { private $guzzle; public function __construct(\GuzzleHttp\Client $guzzle) { $this->guzzle = new…
James Satori-Brunet
  • 901
  • 2
  • 13
  • 28
3
votes
2 answers

Reading stream using Guzzle 6

I'm trying to read the data from an api using Guzzle 6, but have been unable to find any relevant examples. Each line returned from the api is a json object - the aim is to process each line as it is received. The code I have so far is below, could…
Tom Meredith
  • 61
  • 1
  • 4
3
votes
1 answer

Convert Postman request to guzzle or other PHP HTTP client

I have postman request w/c working well. Below is my post url and headers Then here is my content body It works well when I click Send button it returns correct resource, however, when I am trying to do it in PHP using guzzlehttp/guzzle it returns…
Aljay
  • 456
  • 7
  • 21
3
votes
1 answer

Guzzle 6.0 download file using request headers

I can't find any example of how to download a remote file using Guzzle 6.0. I need to pass headers in the GET request. I have looked at the documentation which isn't helpful at all. I came up with this but it still doesn't download a…
Peter Griffin
  • 300
  • 5
  • 18
3
votes
2 answers

Guzzle 6 : How to urldecode query params?

in this code : $customer = \GuzzleHttp\Client(['base_uri'=>'https://example.com']); $response = $customer->request('GET', '/', ['query'=> ['name'=>'Dolce| Gabana']]); All is correct except the parameter of the query is…
Goms
  • 2,424
  • 4
  • 19
  • 36
3
votes
2 answers

Upload File in chunks to URL Endpoint using Guzzle PHP

I want to upload files in chunks to a URL endpoint using guzzle. I should be able to provide the Content-Range and Content-Length headers. Using php I know I can split using define('CHUNK_SIZE', 1024*1024); // Size (in bytes) of chunk function…
Timothy Radier
  • 323
  • 4
  • 15