Reputation: 2000
I am calling an api with guzzle and Sending some data and that api return me some data that i want to recive them and show them so here is my code :
$requestapi = $client->post('http:url/api/v1/transaction/Verify', [
'headers' => ['Content-Type' => 'application/json'],
'body' => '{
"tn":"1905463527",
}'
]);
now when i dd the $requestapi its now showing me the result that verify api returns and just showing me the 200 response .
Upvotes: 0
Views: 464
Reputation: 1175
GuzzleHttp\Client::post
method returns GuzzleHttp\Psr7\Response
object.
You can simply use getBody
method to access the response body.
$response = $client->post(...);
$contents = $response->getBody()->getContents();
Upvotes: 2