How to make curl request by passing raw data to post method?

I have an API. In this API, I pass X-AUTH_TOKEN & X-AUTH-KEY as headers and in the body, I pass raw array data ["1", "2", "3"….]

I have tested it using postman, it is returning me response.

But when I implement it using symfony, I am getting HTTP/2 404 returned for "

This is what I have implemented in Symfony.

$response = $this->httpClient->request('POST', $url, [
            'headers' => [
                'x-auth-token' => $authToken,
                'x-auth-key'   => $authKey
            ],
            'body' => [
                "1",
                "2",
                "3",
                "4",
            ]
        ]);

Can anybody please help me how can I implement?

Thank You.

Source: Symfony4 Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *