Questions tagged [guzzle]
Guzzle is a PHP HTTP client that makes it easy to send HTTP requests and trivial to integrate with web services. Guzzle can be used with cURL, PHP's stream wrapper, sockets, and non-blocking libraries like React.
guzzle
2,592
questions
0
votes
1
answer
37
views
Laravel - Mock single method in a command using PHP UNIT
I'm trying to test a command where there's a method I want to mock because it makes a call to an external service using Guzzle, but no matter what I try, I can't seem to mock it successfully. It ...
0
votes
1
answer
35
views
how to read ndjson stream response in php
sorry if my question is silly but there's something I'm not getting.
I'm using Guzzle in a PHP process to make an API call.
$response = $this->client->request('GET', 'droits_acces', [
...
0
votes
1
answer
57
views
How to make a POST request via GuzzleRequest?
I'm trying to configure an API.
I don't know how I can instantiate a GuzzleRequest to post data and generate authorization header for the API.
This is the GuzzleRequest created
$request = new ...
0
votes
0
answers
15
views
Can I create a mock response in a Guzzle middleware?
I'm writing a PHPUnit test in Drupal and I want to mock the response that the SUT will receive when it makes HTTP calls.
For example, the SUT will make a request to 'http://example.com/some-resource' ...
0
votes
0
answers
57
views
how do I configure composer in my running php & nginx container in Docker?
I've been working with Docker for about a few days and I confused with installing & running different extensions in Docker with composer.The main issue is that I can't properly install compoer ...
0
votes
1
answer
39
views
No data being returned from Auth0 in Laravel 11 upgrade
We are upgrading our Laravel application from version 9 to version 11, and as such we are upgrading the auth0 packages as well. Previously to this upgrade, it has been working perfectly well, but we'...
0
votes
0
answers
18
views
TPN API integration - SoapFault exception: [Client] looks like we got no XML document
When I sent XML data in the Guzzle it worked but when I implemented that on SoapClient it did not work.
Guzzle Code
$client = new Client();
$headers = [
'Content-Type' => 'text/xml; charset=utf-...
0
votes
0
answers
37
views
Display php autorization header on post request after submitting a form
I want to set an API Payment inside my webpage but before using endpoints, we have to generate Headers. The API is coded in Laravel.
Api docs: documentation smobilpay
Github to access Api full code: ...
1
vote
0
answers
84
views
GuzzleHttp How to create an asynchronous request
I've been trying to create an async request for a few days now, and I'm not succeeding either..I don't want to wait for the response from the request, I send the request and the code continues to the ...
0
votes
1
answer
46
views
How can I add multiple query parameters with the same name but different values with Saloon (PHP)?
I integrated a remote API with my PHP web application using Saloon. I usually set my query parameter on my Request like this:
$this->query()->set([
'param1' => 'val1',
'param2' => '...
0
votes
2
answers
115
views
Laravel guzzle http client not able to catch error using error handling
$endpoint = rtrim($site->url,"/").'/'.env('WP_ENDPOINT');
try {
$request = Http::post($endpoint);
dd($request);
} catch (\Guzzle\Http\Exception\ConnectException $e) {...
0
votes
0
answers
22
views
Sending a raw JSON body with Guzzle that contains an array
I am using PHP Guzzle to formulate a request to a 3rd party API tracking service.
I am able to successfully make API calls via a collection I have created using Postman, but I'm having difficulty ...
0
votes
0
answers
36
views
Magento + Guzzlehttp - tracking with legacy API endpoint for Klaviyo
Klaviyo is updating their APIs, so we upgraded the extension in Magento to the latest version, but Klaviyo is still seeing an active legacy API on their end. As per their team, "It's the '/track' ...
0
votes
0
answers
11
views
Multiple HandlerStack in same application causing high response time
One of my backend uses HandlerStack::create(), so I can add to it a custom middleware that is used by all clients. So far, so good.
Recently, I needed to add a new Middleware::retry(), but this need ...
0
votes
1
answer
104
views
Image upload by rest api to TikTok integration via image string generated by binary
I am trying to make http multipart request from my app to tiktok, but getting the response
**param body.data is invalid,detail:type incorrect,expected type:binary**
here is the my code:
public ...