php8.5
Home/ Manual/ soap / soapclient/ SoapClient::__getLastResponse

SoapClient::__getLastResponse

PHP function Edit on GitHub ✎

(PHP 5, PHP 7, PHP 8)

Returns last SOAP response

Description

SoapClient::__getLastResponse(): string|null

Returns the XML received in the last SOAP response.

Note

This method works only if the SoapClient object was created with the trace option set to true.

Parameters Parameters

Return Values

The last SOAP response, as an XML string.

Examples

SoapClient::__getLastResponse() example

php
<?php
$client = new SoapClient("some.wsdl", array('trace' => 1));
$result = $client->SomeFunction();
echo "Response:\n" . $client->__getLastResponse() . "\n";
?>

See Also

  • SoapClient::__getLastResponseHeaders
  • SoapClient::__getLastRequest
  • SoapClient::__getLastRequestHeaders

Source: reference/soap/soapclient/getlastresponse.xml · from the official PHP manual (php/doc-en)