php - Laravel Http Facade not reading body params
Get the solution ↓↓↓I'm sending a request to an API that accepts body params as JSON. But sending a post request it looking like the body params can't be read. How did I know about this is because the API returns the resource instead when the request doesn't have a body.
Has anyone encountered this issue? How can I check that the body params are indeed sent?
TLDR; Laravel HTTP doesn't read body params
$product = Product::findOrFail($id);
$http = Http::withHeaders([
'apiID' => 'someAPIId',
'apiKey' => 'someAPIKey'
]);
$response = $http->post("https://api.com/product/{$product->pid}", [
'p_supplierprice' => $product->stock_qty
]);
$result = $response->json();
Log::info($result);
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: php_network_getaddresses: getaddrinfo failed: temporary failure in name resolution
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.