How can I set parameter in Guzzle service description to be a json array? This is what I have tried but is not working: Call: The json correct json structure to be send is this: Answer You have to write nested definitions as per JSON schema validation rules. I had done this with XML based requests. Let me try this
Tag: guzzle
Proper syntax for Guzzlehttp request containing body and header
I have the following Guzzle send request on my controller :- The above syntax only sending the header but , what is the proper syntax i should use to send both header and body. Answer Guzzle docs has plenty of examples, try reading them.
What’s the equivalent of GuzzleHttpEventSubscriberInterface in Guzzle 6?
In Guzzle 5.3 you can use event subscribers as in the following example: use GuzzleHttpEventEmitterInterface; use GuzzleHttpEventSubscriberInterface; use GuzzleHttpEventBeforeEvent; use …
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: I get dump below from Guzzle Answer getBody() returns a stream. If you want to get all the content at once you can use getContents() method and decode json while at it
Guzzle 6 send multipart data
I’d like to add some data to a Guzzle Http Request. There are file name, file content and header with authorization key. but I get error Catchable Fatal Error: Argument 2 passed to GuzzleHttpPsr7MultipartStream::addElement() must be of the type array, string given, called in vendorguzzlehttppsr7srcMultipartStream.php on line 70 and defined in vendorguzzlehttppsr7srcMultipartStream.php line 79 In Guzzle 6 documentation is something
Proper way to send (POST) xml with guzzle 6
I want to perform a post with guzzle sending an xml file. I did not find an example. What I ‘ve done so far is : No matter what I try I get back error -1 which means that xml is not valid. XML that I send passes online validation though and is valid %100 Please help. Answer After some
Response logging in AWS PHP SDK v3
In v2 of the AWS PHP SDK, I was able to setup logging of request and response information by simply doing this: In v3, I cannot seem to find the solution. Middlewares do not seem helpful as they only fire before the request is sent, and thus I cannot access the response HTTP code. Guzzle v6 has this feature built
Can you include raw JSON in Guzzle POST Body?
This should be soo simple but I have spent hours searching for the answer and am truly stuck. I am building a basic Laravel application and am using Guzzle to replace the CURL request I am making at …
Guzzle returns cURL error 3: malformed
I want to try out the guzzle library and am following through their quickstart tutorial to make http requests to an api. Yet it doesn’t seem to work, because I get the following error: Since I have never worked with cURL before, I don’t even know how to respond to that error message. Here is my code with the request
How to update Guzzle service description for v5?
I have the following service description that I had used for quite a while with older version of Guzzle: Now I am moving bunch of thing to a current version of Guzzle and this absolutely refuses to work with newer broken out guzzle/services. My code is along the lines of: It clearly understands command at least partially, since it will