I want to check the xml based responses from server, here is an example of the response format.
<response>
<code>success</code>
</response>
My existing code,
use GuzzleHttp\Client;
$client = new Client();
$response = $client->post('http://example.com/verify', [
'form_params' => [
'transID' => 1234,
'orderID' => 6789,
'token' => '0X45FJH79GD3332'
]
]);
$xml = $response->xml();
dd($xml);
However, when I make request to the server error occurs like below.
Call to undefined method GuzzleHttp\Psr7\Response::xml()
I believe the documentation is outdated (for version 5.3 actually, I suppose you're using 6.*)
They say Sending a request will return a Guzzle\Http\Message\Response object. In this version of Guzzle, you're getting GuzzleHttp\Psr7\Response instead which does not implement
xml()
method.You can go and check old version at https://github.com/guzzle/guzzle/blob/5.3/src/Message/Response.php and use that method as an example for your code: