All Questions
1,937 questions
1
vote
1
answer
51
views
Class "GuzzleHttp\Promise" not found - but it is there
I am using CI4, php8.0, guzzlehttp/guzzle 7.9.2 & guzzlehttp/promises: 2.0.3. While guzzle works well, when I gets to promises, it fails.
I load up the classes with:
use GuzzleHttp\Client;
use ...
0
votes
1
answer
71
views
In laravel 11 we have used use GuzzleHttp\Client; use GuzzleHttp\Promise;
use GuzzleHttp\Client;
use GuzzleHttp\Promise;
public function all_data()
{
$drivers = DB::table('drivers')->orderBy('id', 'desc')->get();
$client = new Client();
$...
0
votes
0
answers
42
views
Saving an entity with compressed client response and request in Symfony 7
Initial Situation
I have an application in Symfony 7. In this application, I am making external API calls, for which I have an abstract class HttpClient defined. In this class, I use guzzle Client to ...
1
vote
0
answers
23
views
GuzzleHttp local certificate xrpl-php
Good day! I’ve successfully installed this crypto github repo: https://github.com/AlexanderBuzz/xrpl-php on my local machine and I'm attempting to run example files yet receive the following error ...
1
vote
1
answer
63
views
http request conversion from php to node
Im passing legacy php server to node. i have this php guzzle http request to some dashboard:
$request = $this->http_client->request('POST',
$url,
[ 'headers' => ['Content-type: ...
1
vote
1
answer
77
views
Unable to post using GuzzleHttp: Error: Header value must be scalar or null but array provided
I'm trying to post the following html form using GuzzleHttp but I'm unable to do so because of the error while setting the form_params in the header. InvalidArgumentException: Header value must be ...
0
votes
0
answers
198
views
PHP Google cloud function got OpenSSL Error messages: "CURL error 35: error:0A000126:SSL routines: unexpected eof while reading"
I'm running a Google Cloud Function to perform an asynchronous task using pcntl_fork and Guzzle Client to handle external API requests .
When I make an external API request to a third-party service, I ...
0
votes
2
answers
64
views
Why are the headers empty?
I am trying to get a simple redirection to work with GuzzleHttp and am using phpunit to test my code. The expected behavior is that if the requested URL ends with a "/" then the response ...
4
votes
2
answers
295
views
Formatting OpenAI responses
I've created an OpenAI-powered platform for teachers in my district to create AI Bots that have thematic chats with students (i.e. why is socialism so polarizing in the US, etc). These chats are saved ...
0
votes
1
answer
74
views
Laravel 8 guzzle SOAP request returns error 500
I'm trying to do a POST call with SOAP in Laravel 8 to get some data, but if I put headers on the call, the remote server returns error 500.
Also if no headers are defined, I receive an empty response....
0
votes
1
answer
88
views
Is there a way to send a HEAD and GET request using php?
I would like to obtain the headers of a resource without actually downloading it, especially because I am trying to inspect headers of bigger media files. However the URLs are behind redirects, and I ...
0
votes
1
answer
139
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
132
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
89
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
212
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
0
answers
24
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
40
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
193
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
58
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' => '...
1
vote
2
answers
398
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
14
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
234
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 ...
1
vote
1
answer
107
views
Why Guzzle onrejected function in promise-then still throw an exception?
I found that the $promise->wait() function will throw an exception and I must use try-catch to handle exception again.
$promise = $this->client->sendAsync($request);
$promise->then(
...
1
vote
1
answer
53
views
How do I log guzzle multi requests?
I have this code for creating a Guzzle client with logging:
$loggerMiddleware = new Logger(function ($level, $message, array $context) { ... }
$handler = new CurlMultiHandler();
$stack = HandlerStack:...
0
votes
0
answers
32
views
use Guzzle wit name.com api
use Guzzle wit name.com api
that is the Curl example
curl -u 'username:token' 'https://api.dev.name.com/v4/domains:checkAvailability' -X POST -H 'Content-Type: application/json' --data '{"...
0
votes
0
answers
70
views
How do I format Guzzle POST request
Guzzle beginner here. I have an API request that I've got working in Postman and the raw CURL code works but when I try the GuzzleHTTP approach, it fails with
406 Not Acceptable response: Could not ...
0
votes
0
answers
66
views
Adding Guzzle Client Middleware to use proxy based on request URL in Laravel
I'm using Guzzle HTTP client for making requests from my Laravel 10 application.
I want to use a proxy for some URLs, thought about doing so with middleware.
Thing is, in order to intercept the ...
0
votes
0
answers
108
views
Issue with Guzzle Graphql request using parameters
I'm trying to execute a simple graphql query with parameters, but I can't get it to work. Any idea what I'm missing?
A query without parameters works fine.
Below the code i use and error I receive. P....
0
votes
0
answers
108
views
GuzzleHttp Promises problem: requests are running synchronously
I have a problem. In the code below I use GuzzleHttp Promises to handle asynchronous requests.
What happens here is that the requests start asynchronous but when I enter in the loop in the then() call ...
0
votes
1
answer
261
views
In Laravel 9, the authorization header gets dropped on some requests using the HTTP Client (GuzzleHTTP)
I'm using Laravel 9, and using the HTTP Client (GuzzleHTTP) to make calls to an API. Previously this just worked, however the last few days something has changed (On their end, I believe) and my ...
0
votes
1
answer
157
views
How can i pass a Symfony Request to another Controller with Guzzle
I have a Symfony project made up of several microservices, each in a different repo, and a microservice that acts as an API Gateway, through which the fronts make their calls in order to verify user ...
0
votes
1
answer
350
views
PHP8 and guzzlehttp package
I have updated my local setup with PHP 8.2.13 version, my project is working fine.
I have third party API call within my project which is implemented with guzzleHttp client class. GuzzleHttp version I ...
0
votes
0
answers
43
views
PHP UrlEncode and UrlDecode are not accepting the word NULL in an SQL String submitted with GUZZLE
So I'm passing in a Query where there is the condition
where X is NULL
is the condition at the end of the SQL.... it is using
"{"query":"".urlencode($this->query)."&...
0
votes
0
answers
334
views
Fatal error: Cannot redeclare GuzzleHttp afetr installing it using Composer
I've installed manually the SDK package of Amazon AWS a long time ago in a website.
And I'm calling it like this:
require $_SERVER['DOCUMENT_ROOT'].'/aws/aws-autoloader.php';
use Aws\S3\S3Client;
...
1
vote
1
answer
142
views
Using Guzzle HTTP client for multiple API requests, but getting the results from my 1st api call when using json_decode for my 2nd api call response
I am working with PHP in my Symfony project. I need to use the data, from my 1st API call, in my 2nd API call. Furthermore, I am using the Guzzle HTTP client. Everything is working properly, except ...
1
vote
1
answer
1k
views
cURL error 5: Could not resolve proxy when using proxy request in PHP Laravel with Guzzle
I have a function that checks if a proxy is working using Guzzle. The code is as follows:
private function isValidProxy($ip, $port, $username, $password)
{
// Construct proxy URL with ...
3
votes
0
answers
5k
views
cURL error 6: getaddrinfo() thread failed to start
Since several months, I get the curl error 6 thread failed to start inside my Laravel job queue on all my HTTP call.
I understand that it's related with the ulimit variable of my server, but even with ...
1
vote
1
answer
71
views
Mimic curl working script in Guzzle (multipart data with binary uploads together)
I have curl command that works perfectly (using img2img via Stability API):
curl --request POST 'https://api.stability.ai/v1/generation/stable-diffusion-xl-1024-v1-0/image-to-image' \
--header '...
0
votes
0
answers
158
views
Basic auth with Guzzle showing 401 in Postman
I'm posting to a valid endpoint with valid JSON. The problem seems to be around authorisation. If I dump the JSON from my web app and insert that directly into my API, I get the result I'm expecting. ...
0
votes
1
answer
134
views
How can I access variables within a Guzzle promise "then"? [duplicate]
I'm trying to make use of Guzzle to send two POST requests one after another (first to create a user, then to assign them a segment) and I seem to be struggling with accessing the variables I've ...
0
votes
1
answer
194
views
The text with the attached file is not sent to Discord in PHP
My task is to send a signed file to Discord private messages. I use php 7.2, Laravel 5.8 and Guzzle 7.0. The file (PDF) is stored on the server.
$discordBaseUrl = 'https://discord.com/api';
$channelId ...
2
votes
1
answer
423
views
Simulate read_timeout with Guzzle
I need to test that my PHP script is correctly handling the read_timeout option in my Guzzle requests. So I wrote 2 PHP scripts, one calling the other using Guzzle and I want to achieve the timeout ...
0
votes
0
answers
85
views
Laravel: when executing a guzzle POST and receiving a 302 Response(expected) how to proceed
The way this works is that I first do a guzzle POST request with certain data and I receive a Guzzle 302 Response object. That's expected..I should go to a external page then.
But when following the ...
0
votes
0
answers
56
views
object in array to retrieve values separately with json encode, json decode, but the array return null
I'm PHP junior developer, and I still have to learn so please be understanding :)
I use Ninja API to return information about cars, this API returns an object, and everything works correctly,
but I ...
0
votes
1
answer
194
views
Guzzle is ignoring base_uri
I'm trying to connect an erp system's Rest API with Guzzle like this
$client = new GuzzleHttp\Client([
'base_uri' => "{$this->getBaseUrl()}{$this->getClient()}/",...
1
vote
0
answers
124
views
Failing to connect to Microsoft Bookings API
I am trying to pull Microsoft Booking calendar data into my WP site.
I have created the required web app and granted my user the required access and delegation to connect to the app, and gave my app ...
2
votes
1
answer
558
views
completeMultipartUpload: s3 error 411 content-length
I'm getting a content-length 411 error. The variables in completeMultipartUpload are all valid, as well as their structure. The issue is the content-length header: Here's the error:
S3 Error: Error ...
0
votes
1
answer
117
views
Laravel Get User Info Error URI must be a string or UriInterface
I have problem when google get user info in production
from local it success
this my code using guzzle client:
use GuzzleHttp\Client;
$client = new Client();
$requestAPI = $client->get('https://...
0
votes
0
answers
274
views
Why i keep getting 400 Bad Request response using guzzle
I'm trying to parse an HTML response from a server. but currently i am stuck with post request guzzle. I keep getting 400 Bad Request when i tried to make post request.
Error message:
GuzzleHttp\...
0
votes
1
answer
290
views
How to modify the Saloon or Guzzle libraries in Laravel globally?
I have a project that uses the Saloon library for creating APIs for different external providers. It is really helpful. This library uses Guzzle internally, so I would like to know how to modify the ...