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.
2,488
questions
0
votes
0
answers
12
views
How to pass arguments to the PUT request in codeigniter?
I am using codeigniter-3, i have to update the data but the API is extrenal API .i am using Guzzle class to contact with that api it's working fine but it's not updating the data because it's not ...
0
votes
0
answers
31
views
How to get query params and set to the url in codeigniter-3?
i am using codeigniter-3, i have some API's i want to call those API's in the codeigniter-3 for that i use Guzzle class i want to get the id from the view file and i want to set according to the API ...
0
votes
0
answers
130
views
PHP file_get_contents returns 404 on image download
I am trying to download images using the PHP function file_get_contents() but on some images the server returns a 404 error. I sent User-Agent Slow Down but the results were the same.
Can someone here ...
-1
votes
2
answers
46
views
What files are required after using composer
I ran composer in order to use guzzle. It resulted in these directories:
composer
gabrieldarezzo
guzzlehttp
psr
ralouphie
symfony
I noticed the file car.png in the ...
0
votes
0
answers
29
views
PHP + Laravel | guzzlehttp/guzzle HTTP Client Cache Invalidation / refresh
Question
How can I programmatically tell to a Guzzle Client to delete / eliminate or refresh a Cache folder?
An even better, to target a specific folder X or Y?
The reason is not important, but I can ...
0
votes
0
answers
28
views
Guzzle/Crawler get data and insert to database
I new to Laravel Orchid, and I want a script like fill some values from a site The point is I have a site with links, and I want to open these from script, and I want the values from the third site ...
-1
votes
0
answers
46
views
Laravel Queued Job, API request creates curl error 7
I have a job which makes a post request to another API I created on the /deploy endpoint, over HTTPS. When testing in postman, I have absolutely no issues connecting to or using said API, on any ...
0
votes
1
answer
39
views
How to make post request to get data Laravel Guzzle?
Let say, the Secret Key is XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX and md5key is YYYYYYYY.
I made a Query String QS
Qs = “method=RegUserInfo&Key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&Time=20140101123456&...
0
votes
0
answers
24
views
Laravel HttpClient Guzzle. Images and Array not sending at same time. 'A 'contents' key is required
//These Images
for($i = 0 ; $i < count($request['images']); $i++)
{
$response = $response->attach('images['.$i.']', file_get_contents($request['images'][$i]), 'image.png' );
}...
0
votes
0
answers
26
views
GuzzleHttp\Exception\ConnectException: cURL error 7: Failed to connect - Laravel
I'm trying to post a Third party Api with raw body with my controller , It works fine when I test it from localhost , but when I publish my project on the Server (Cpanel) , I get this Error :
...
0
votes
0
answers
46
views
How to authenticate when consume api in Laravel?
I'm trying to integate api service into my laravel web app. From login & every operation in my web app is using the api. But I always get response 401 unauthorized whenever I hit the api endpoint.
...
0
votes
1
answer
79
views
Google Chat API. Can’t create space. Method not found
I'm trying to create a google chat space via making a post request to https://chat.googleapis.com/v1/spaces with Guzzle.
$scopes = [
'https://www.googleapis.com/auth/chat.spaces....
1
vote
1
answer
28
views
Adding Query string params to a Guzzle GET request without removing existing query params?
I am using guzzle Http client request for GET method, what i am doing i am sending request to some dynamic url which i am fetching from DB and than appending some field into it and sending request
...
0
votes
0
answers
24
views
How to use curl with Post query mutation in php Laravel
I write the code for use api endpoint in my laravel project to get some response.
this endpoint requires me to post with x-www-form-urlencoded containing the query string mutation:
curl --location --...
0
votes
0
answers
15
views
How to set the cookies response when calling nodejs api from laravel?
I have on linux server a running nodejs and laravel. When I try to call the nodejs api endpoint. The response is
{"errors":[{"msg":"Invalid value","param":"...
0
votes
1
answer
19
views
Using Guzzle with Cloudflare images service
I'm using the cloudflare image service but I can not find an working example using guzzle.
I want to upload an image using direct upload and custom id:
curl --request POST https://api.cloudflare.com/...
0
votes
1
answer
24
views
Laravel eloquent in Lumen api dont save when data comes from HTTP Client Laravel, but when i test with Postman that works
I have a page with send data to an Lumen API. I send the data using the Laravel Http Client, like this:
$url = env('API_ADDRESS');
$data= [
'p1' => $request->input('p1'),
...
0
votes
3
answers
29
views
Tried to made an POST request using Guzzle
Im so new using API in my project, so i tried to make an POST request using Guzzle in Laravel, but i really dont know to do it, i've been seraching on the internet how to but i can't find the answer, ...
0
votes
0
answers
32
views
Installation issue with guzzlehttp/guzzle version
I'm trying to install the package erusso7/redsys-rest but it shows this error:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Can only install one of: ...
0
votes
0
answers
70
views
Problem to upload file with from-param in Laravel 8 external api with guzzle or HTTP client
I am using Mirakl api. I faced an issue with the file upload with form-peram in Laravel 8 external api with guzzle or HTTP client.I got 400 Bad Request.The api expects file with from-param like this
{
...
0
votes
0
answers
28
views
$client = new \GuzzleHttp\Client(); gives me a 500 error in PHP
I need to make an API CALL to an Email Marketing called Sender.net, but this sentence gives me an error: $client = new \GuzzleHttp\Client();
If I remove that sentence, the code works, but if I put ...
0
votes
1
answer
32
views
How to do concurrent guzzle http post request to rest api in laravel?
I want to make concurrent Guzzle http requests in laravel to rest api i have users in 100k i want to perform billing for users.
Currently my guzzle http is doing synchronous calls to rest api which ...
2
votes
1
answer
37
views
How to use Rewrite this code with GuzzleHttp
I wanted to use Http facade in Laravel 5.8 but I noticed that Http facade is not included in this version of Laravel so I installed GuzzleHttp.
But now I don't know how to rewrite this code with this ...
0
votes
1
answer
40
views
GuzzleHttp Can't Be Installed On Laravel 5.8
I'm working with Laravel 5.8 and I wanted to install GuzzleHttp package.
Firstly I tried running composer require guzzlehttp/guzzle, but I got this error:
Problem 1
- guzzlehttp/guzzle[7.4.0, ..., ...
2
votes
0
answers
203
views
Guzzle oauth2 authentification issue
I am trying to connect to an oauth2 system using guzzle but I keep getting this message:
$guzzle = new GuzzleHttp\Client;
$response = $guzzle->post('https://logincert.anaf.ro/anaf-oauth2/v1/...
0
votes
1
answer
47
views
How to avoid resulted in a `418 You look like a robot (4)
I am using guzzle php library to scrape the data from other sites.
PHP script without proxy
$httpClient = new \GuzzleHttp\Client();
$response = $httpClient->get($url);
$htmlString = (string) $...
-1
votes
0
answers
24
views
I'm using Guzzle, getting an http request body error
I'm test request by Postman, this return response data. But I try request by Guzzle. it response error:
{"data":null,"error":114,"error_msg":""} '
I'm request ...
0
votes
1
answer
64
views
MS Graph Access Token Refresh with GuzzleHttp
I'm trying to refresh an access token using a refresh token on MS graph platform. To do this I've been inspired by this documentation from Microsoft:
https://docs.microsoft.com/en-us/azure/active-...
1
vote
2
answers
43
views
How to set query parameters with same name as Guzzle?
I have no problem setting query parameters in Guzzle. But I can't add parameters with the same name. My query params array is below.
$query_params = array(
'test' => 'abc',
...
0
votes
1
answer
26
views
PHP JSON data missing after decoding from api
I am getting data using guzzle http GET call. It retrieves the data fine and I know that all the data is retrieved. However, when I try to get data from child object/array after decoding the body I ...
-1
votes
0
answers
30
views
Solve composer version conflicts (downgrading)
I have a Problem installing an SDK for an API on my Laravel Project.
The problem is that the SDK requires guzzlehttp/guzzle as well as psr/log to be multiple versions lower than what Laravel is using ...
0
votes
0
answers
12
views
Cannot send request locally with Guzzle
Everytime I try to send requests locally I get the same error:
GuzzleHttp\Exception\ConnectException: cURL error 7: Failed to connect to 127.0.0.1 port 8000: Connection refused
Same thing happens when ...
0
votes
0
answers
30
views
Guzzle calls in helper function randomly return 'magic request methods require a URI' error
My server is running on PHP 7.2 - Laravel 5.8 - Redis Jobs - NewRelic for monitoring configuration.
The guzzle call is written inside helper function (that is autoloader from composer.json). The ...
-1
votes
1
answer
113
views
Laravel Http Client add api key into request
On my Laravel project (laravel version 9) I have to connect on a third part api using an apikey on the url and I have to get the response in json format.
To not having to repeat the same code over and ...
-1
votes
1
answer
57
views
Guzzle with Laravel 9
I'm working on Lavravel 9 with guzzle to send some data in
the below code need to get some data from the database how can get data from the database?.
$response = Http::post('APIurl', [
"...
0
votes
2
answers
66
views
Laravel http facade conditionally add methods
I'm working in Laravel 8 and am using the Http facade client to make requests. Currently, my set up has a database table where I store a auth_type enum column with the different auth types, I also ...
0
votes
2
answers
30
views
Larevel HTTP client error 403 on production
I'm working on a project that calls an e-commerce website to get some information and does analysis on them.
I wrote the following code to get the information:
use Illuminate\Support\Facades\Http;
...
0
votes
0
answers
87
views
when use guzzle retry middleware, if the final HTTP protocol errors is 4xx or 5xx, it calls fulfilled, not rejected
I try it 3 times if the HTTP protocol errors is 403,no matter what the HTTP protocol errors is, it calls fulfilled, not rejected.
Exceptions are thrown by default when HTTP protocol errors are ...
2
votes
0
answers
69
views
Guzzle - PHP - Several minutes timeout even when connect_timeout and timeout parameters are set
I use the following Guzzle constructor with connect_timeout and timeout set to 6.0 seconds:
$this->client = new GuzzleClient([ ...
0
votes
0
answers
18
views
Guzzle ClientException contente property on TraceableResponse
I have this Guzzle API call that causes a ClientException to be thrown. When dumped out the exception has a content property on the TraceableResponse This content has the actual error from the API ...
0
votes
0
answers
560
views
cURL error 56: OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 104
Hi I am sending file to server side that require integration service uses TLS/SSL.
Below is my code sending file
$client = new GuzzleHttp\Client(['base_uri' => 'https://secure.urganda.com/api/...
0
votes
0
answers
47
views
Is it possible to proxy a stream with Guzzle?
On my cron batch I am getting images from one server and posting them to another server.
Currently I am doing this:
GET an image with guzzle and store in on disk inside /tmp folder
POST the image to ...
0
votes
1
answer
88
views
Guzzle: Call to undefined method GuzzleHttp\\\\Psr7\\\\Stream::getStatusCode()
I'm trying out guzzle in mu laravel app in order to use FCM notifications, for some reason I'm getting the following error when I try to get response status code, also am I using guzzle correct syntax?...
2
votes
0
answers
43
views
Replacement for GuzzleHttp\UriTemplateFactory?
I have a plugin (for Magento 2.4.4), it is using the following class "GuzzleHttp\UriTemplateFactory" but "UriTemplateFactory" is deprecated and removed from Guzzle. Looking for a ...
0
votes
1
answer
64
views
Does Guzzle Client inherit Client from handler?
Using PHP 8.1, Laravel 9, Guzzle 7.4.2.
I have this snippet in a service singleton registered in AppServiceProvider:
$middleware = new AccessTokenGuzzleMiddleware(
client: new Client([
'...
0
votes
2
answers
32
views
Get API response URL param using Guzzle HTTP request in Guzzle 7
I searched online but couldn't find a proper solution. I am calling a Spring service with a POST request using Guzzle Client, The service in case of any errors provides the error message in its URL ...
2
votes
1
answer
51
views
Laravel: Solution for multiple jobs using HttpClient?
i have a bunch of laravel jobs who connect to an external API, fetch some data and processes the data.
Because it is very different data, i splitted it into multiple jobs (GET_DATA_A, GET_DATA_B, ...)
...
0
votes
0
answers
17
views
Get transfer time for concurrent guzzle requests
I want to get the transfer time for my concurrent and async pool requests but I do not understand how I may combine on_stats with the concurrent model.
$client = new Client();
$domains = [];
foreach (...
0
votes
2
answers
79
views
How to fake cookie for HTTP fake respond?
I want to mock a HTTP response in Laravel with cookie. I tried this:
Http::fake([
'my-mocked-route' => Http::response(['foo' => 'bar'], 200)->withCookie('a', 10),
]);
but I receive
Call ...
0
votes
0
answers
39
views
Problem with Guzzle Client unable to keep same session
I am currently developing a library to call the pCloud API.
So far I've been able to do what I wanted to do, but I happen to have a problem with the http client (Guzzle, Curl).
I would like to use the ...