Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions core/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ protected function array2xml($arr, &$xml)

final class Client extends iClient
{

/**
* Store the last response body string
*/
protected $lastResponseBody = null;

public function __construct($login, $password, $options = [])
{
if (empty($login) || empty($password))
Expand Down Expand Up @@ -270,6 +276,7 @@ public function raw_file_put($url, $content, $headers = [])
*/
public function request($method, $url, $options = [], $parse = true)
{
$this->lastResponseBody = null;
try
{
$response = $this->client->request($method, ltrim($url, '/'), $options);
Expand All @@ -285,6 +292,14 @@ public function request($method, $url, $options = [], $parse = true)
}
}

/**
* Returns the XML string received in the last response.
* @return string $lastResponseBody
*/
public function getLastResponseBody() {
return $this->lastResponseBody;
}

/**
* Prepare XML string body
*
Expand Down Expand Up @@ -335,6 +350,7 @@ private function parseResponse($response)
}

$responseBody = (string) $response->getBody();
$this->lastResponseBody = $responseBody;

if (!$responseBody)
{
Expand Down