45 questions
1
vote
1
answer
260
views
How do I upload a file from a string, without saving it to disk, with Symfony Http Client?
I'm trying to upload a file to an API, that requires a multipart form upload.
I don't want to store the file locally (I read it from an S3 bucket using flysystem) but I can'get it to work (always get ...
0
votes
1
answer
439
views
How to upload a stream using Symfony HTTP Client?
I have a function that sends requests using Symfony HTTP Client, for example, here's what that function uses to send the request:
$response = $client->request($method, $url, [
'...
0
votes
0
answers
156
views
Get client uploaded file and send it to Backblaze api?
I'm building an API with Symfony and using Backblaze as a cloud storage solution. I want to allow my users to upload images that they will be allowed to use later. All my users have a specific bucket ...
0
votes
0
answers
186
views
http-client - clients uncommonly get sslv3 alert handshake failure
http-client version 6.3.
Requests to API server are run from another server.. Both running Symfony. So there is no direct call to API from the browser and old browser is not an issue here since the ...
0
votes
0
answers
723
views
Measure Symfony's httpClient and Doctrine queries execution time and create Prometheus metrics
there are actually two separate questions under this title
I am trying to figure out how to measure the requests duration made to external services in Symfony application via the httpClient and same ...
0
votes
1
answer
6k
views
Symfony Retryable HttpClient and timeout option. How it works when used together?
In the new Symfomy 5.2 a Retryable HttpClient was implemented.
Failed requests can now be retried by default in case of failure.
However, I could not debug or understand how the timeout option is ...
3
votes
1
answer
2k
views
Symfony httpClient $response->getInfo() returns empty values
I'm trying to measure the response duration for some services called from my application.
I just need a simple method and a rough value is good enough, and I thought I could simply use total_time from ...
5
votes
1
answer
3k
views
Make an HTTP request without waiting for the response using Symfony HTTP Client
Is it possible to send a request using Symfony HTTP Client without awaiting the response?
In my use-case some requests to my app should notify a third-party service. The response of that service is ...
0
votes
1
answer
1k
views
Json option in httpClient Symfony throw error
I'm using httpClient on symfony and I'm calling an API
I want to use the json option instead of using body but it won't work, when I use body and I type in json format everything work but I don't find ...
0
votes
0
answers
37
views
Cannot make request internally to my symfony application served on localhost:8000 [duplicate]
I have Symfony application running through docker.
It served on http://localhost:8000/. I'm trying to test my API routes, for example to check if they are available when JWT provided or not, check ...
3
votes
1
answer
3k
views
Symfony HttpClient Stream and chunk->getContent() Body size limit exceeded
In my Symfony project, I created a controller and a function to retrieve the content of an APi.json from a site.
I am using HttpClient to grab the content and embed it into a new file in the project.
...
1
vote
0
answers
964
views
Symfony SSL connect error for in http client
I use http client component in my project symfony for external apis but I found this error when i test api:
SSL connect error for url
configuration of component is basic configuration and also ...
1
vote
1
answer
2k
views
Symfony equivalent of curl_setopt using the httpClientInterface service
I need to make a call to an external API.
The API docs says
curl_setopt($ch, CURLOPT_URL, "https://api.simkl.com/search/file");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($...
4
votes
2
answers
4k
views
How to forward a Symfony Request to another server using the Http Client (with optional changes)?
How to intercept a request and send it with HttpClient to another server and return the response from that server after some modification?
The original request will contain data and files. I am ...
10
votes
1
answer
7k
views
Why can't I access the response content when the Symfony HTTP Client encounters an error, and an exception is thrown instead?
I want to make a request to retrieve user info from OAUTH server with Symfony HttpClient but I can't fetch fetch the response directly when encountering an error response, because the client throws an ...
1
vote
1
answer
790
views
Unable to read gzip encoded in using HttpClientInterface in Symfony Project
I'm unable to read gzip encoded response in a Symfony projet. Here is my service :
<?php
namespace App\Service;
use Symfony\Contracts\HttpClient\HttpClientInterface;
class myApi
{
private $...
2
votes
2
answers
2k
views
Posting with Symfony 4.4 HTTP Client not working, status code 422
I want to post info to external api but I get error 422 all the time. Geting info and authorization works fine. I'm using Symfony Http Client, authorization and headers are defined in framework.yaml ...
0
votes
1
answer
258
views
How can I rename a webdav collection using Symfony Client?
I am using an http Client with Symfony. In this example I am creating a folder.
$client = HttpClient::create();
/* @var $response ResponseInterface */
$createFolder = $client->request('MKCOL', $...
-1
votes
2
answers
2k
views
How can I make a http client request after another is completed?
In my Symfony function I am creating a folder, and inside this folder another folder:
$client = HttpClient::create();
$createFolder = $client->request('MKCOL', $path.$foldername, [
'auth_basic' =&...
2
votes
1
answer
3k
views
How can I access the URL of a Symfony Http Client response?
With the Symfony Http Client I create a HTTP request like this:
$client = HttpClient::create();
$response = $client->request('GET', 'www.mypage.com', [
'auth_basic' => ['user', '123'],
]);
...
1
vote
2
answers
1k
views
How to pass an object into the http client request?
I have tried making a HTTP request using CURL as below:
$rawQuery = '{
"CUSTNAME" : "1970188",
"CURDATE":"2020-12-28T00:00:00+02:00",
"BOOKNUM&...
0
votes
2
answers
2k
views
How to solve "There is no extension able to load the configuration for 'monolog.http_client' "
I want to use the HttpClientInterface from symfony, so i added it in __construct like this:
private HttpClientInterface $client;
/**
* @param HttpClientInterface $client
*/
public function ...
3
votes
2
answers
11k
views
Symfony 5 - HttpClient, Add "Authorization bearer 123456789azertyuiop" in headers data
I would like to attach authentication information in the header of an HTTP request using HttpClientInterface.
(I already have 45 other methods that work very well) but my problem occurs when I try to ...
0
votes
1
answer
342
views
Symfony 5 httpClient Windows AD connection
Is it possible to connect to an API with windows Credentials?
I need to connect on an API witch uses Windows AD authentication.
I thought thats works with auth_basic but it's not the good way...
...
3
votes
1
answer
4k
views
Symfony: Define scoped HttpClient class
In my Symfony 5.1 app, I am using several scoped http clients, defined in my framework.yaml:
framework:
http_client:
scoped_clients:
my_client:
....
...
0
votes
3
answers
4k
views
How can I create a MockResponse with statusCode 400 header for MockHttpClient?
I would like to test different responses from an API using symfony/http-client, but how can I create statusCode 400?
This is what I tried:
public static function mockShipmentResponseFail(): ...
0
votes
1
answer
5k
views
HTTP/2 400 returned for URL when using symfoy HTTP Client to make post request
I want to transform a http post request tested with post man to symfony action :
I want to transform the payload to a json array in symfony to send data to url :
<?php
namespace App\Controller;
...
1
vote
1
answer
2k
views
How to serve same response from HttpClient in my controller using Symfony?
I have a Controller that must forward the received request (changing some query parameters) to another server, and returns it's response (with same headers, status and body).
I decided to use ...
3
votes
1
answer
1k
views
How to make HTTPClient request appear in Symfony profiler?
I'm using Symfony 4.4.7 and making http requests with HTTPClient (Symfony\Component\HttpClient\HttpClient) but requests doesn't shown in profiler. How to make this profiler tab work?
6
votes
1
answer
5k
views
How to mock the Symfony HttpClient as a dependecy?
I have a class into which I inject an instance of Symfony\Component\HttpClient\HttpClient as a constructor parameter.
I'm looking at the documentation page at https://symfony.com/doc/current/...
4
votes
2
answers
7k
views
Symfony HttpClient GET request with multiple query string parameters with same name
I am trying to make an API request in the following format:
/api/v1/courses?enrollment_state=active&include[]=total_students&include[]=term
How can I do so using the HttpClient Component ...
1
vote
2
answers
3k
views
Request with Symfony HttpClient returns code 0, when the same request with postman works fine
I have a weird problem where a request I make (to my mercure hub) with postman works fine, however the Publisher class (from the Symfony mercure bundle), which uses the Symfony HttpClient will yield ...
-2
votes
1
answer
737
views
How to test a lexik_jwt_authentication protected API using http_client?
I am writing some functional test and looks like the client can't find the controller for the route, this is the code for my test:
$response = static::createClient()->request(
'POST',
'/api/...
0
votes
1
answer
681
views
Max execution time excedeed when trying to call API route in another API Platform
In a very specific context, I need to renew my JWT after performing some actions with API Platform.
I didn't find an effective way to call another route directly and so I went through a curl request.
...
15
votes
1
answer
10k
views
Cannot retrieve error message using Symfony HttpClient if the response is not "ok"
I use Symfony HttpClient to call an external API. When the status code is 200 I can use getContent() method to retrieve the API response. If the API response is 400, a ClientException is thrown, and I ...
2
votes
0
answers
12k
views
How to use Symfony HttpClient post data
I want to simulate this CURL command using Symfony 4 HttpClient component :
curl http://localhost/endpoint -F server=123 -F user=me -F fileUrl=@/tmp/test.xml -F reply=1
I tried the Symfony doc ...
2
votes
1
answer
5k
views
Reusing Symfony's HTTP Client results in error, but executing the request with a new instance works as expected
My system needs to authenticate with an external service (out of my control in any way), and the authentication requires two HTTP requests in very short sequence (the token I get in the first request ...
2
votes
1
answer
5k
views
HttpClient Component Authentication
I need to to be authentificate when create a HTTP request, in the documentation
$httpClient = HttpClient::create([
'auth_basic' => ['[email protected]', '45@8888'],
]);
$...
1
vote
2
answers
7k
views
How can I add proxy with IP/port and username/password in CurlHttpClient on Symfony HttpClient Component?
I'm using Symfony HttpClient Component, it became necessary to use it with a proxy. Open proxy with the port, I can easily configure with the default configuration when instantiating CurlHttpClient ...
0
votes
2
answers
680
views
Loading a Symfony parameter in the AppKernel
We need to store our cache and log files outside of the project folder structure. I have set up parameters_prod.yml and parameters_dev.yml that will be build by Bamboo on deployment to different ...
0
votes
0
answers
70
views
symfony httpkernel instantiation full stack framework
Can anyone point me to the place where the HttpKernel is instantiated or better asked where it is configured as a service?
what I know:
in symfony full stack front controller: "app_dev.php"
$kernel ...
2
votes
1
answer
9k
views
symfony2 test client request with POST data
I want to test login with facebook on a symfony webapp.
I've created a test user and requested an access token for this user, now I want to send the below POST request:
public function setup()
{
$...
0
votes
1
answer
197
views
symfony output in kernel.php
in app.php
$kernel = new AppKernel('prod', false);
in Kernel.php
public function __construct($environment, $debug)
{
print('test');
$this->environment = $environment;
...
0
votes
1
answer
1k
views
Symfony2 call kernel more than 1 time
I've problem with symfony2. While load page symfony load Kernel more than 1 time here is dump..
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\...
0
votes
0
answers
286
views
Symfony2 load external AppKernel file inside application
I need to load an external AppKernel file inside my symfony application. This external AppKernel is responsible for handling requests. The problem is, It can't autoload the classes/bundles that the ...