2,594 questions
1
vote
1
answer
50
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
70
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 ...
0
votes
0
answers
21
views
How can I get Laravel's Http client to return a rejected promise for a failed request?
Laravel's Http client has a throw() method which makes calls fail with an exception for synchronous calls:
$resp = Http::throw()->get('https://www.google.com/fake'); // throws RequestException
...
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 ...
0
votes
1
answer
83
views
Laravel Pulse with GuzzleHttp/Client and custom base_uri
I'm trying to add laravel-pulse-guzzle-recorder to my Laravel Pulse, to record
Slow Outgoing Requests when using a GuzzleHttp/Client instead of the builtin Http facade.
Docs say you need that the ...
4
votes
2
answers
293
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
1
answer
32
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
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
1
answer
83
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
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
25
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
41
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
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
155
views
PATCH Request Body empty after converting Symfony HttpFoundation to PSR7
I'm attempting to send a PATCH request as follows, convert it to PSR7 and then validate the request using OpenAPI PSR-7 Message (HTTP Request/Response) Validator, which fails with the following ...
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
35
views
How to get details from a Guzzle ConnectException
I'm using the lats version of the https://github.com/googleapis/google-api-php-client on php 8.1.11 for Google Sheets.
I import datas with a pasteDataRequest(). I very often catch a Guzzle ...
0
votes
1
answer
168
views
In Laravel, using Http Client, how can I get the headers that will be sent in the request?
I'm making a request using the Laravel Http Client, and I want to know the exact headers that will be sent (or were sent) in the request. I'm not trying to set them. I want to read them.
Does anybody ...
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 ...
-2
votes
1
answer
181
views
guzzlehttp/guzzle Conflicting With Important Packages
I have a coinbase/coinbase-commerce package in my project that requires guzzlehttp/guzzle ~5.0|~6.0 and it's satisfiable by these versions guzzlehttp/guzzle[5.0.0, ..., 5.3.4, 6.0.0, ..., 6.5.8].
I'm ...
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
2
answers
265
views
GuzzleHttp\Exception\ConnectException: Connection refused for URI errors When Setting Up Local Development Environment
I'm encountering multiple connection refused errors while attempting to configure a local development environment for the website on my Windows desktop. The website application is based on Drupal 10, ...
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
104
views
CORS Issue when Interacting with Instagram HTML in Laravel Guzzle
I'm working on a project where I need to log into Instagram programmatically within my Laravel application. I've successfully fetched the Instagram HTML on the server side and displayed it on the ...
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
votes
1
answer
360
views
How to boost a post using facebook graph API?
I have been working with Facebook Graph API and first tried to create an Ad with Graph API Explorer but its returning error as
{
"error": {
"message": "Invalid parameter&...