You are here

protected function RemotePostWebformHandler::getResponseData in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Plugin/WebformHandler/RemotePostWebformHandler.php \Drupal\webform\Plugin\WebformHandler\RemotePostWebformHandler::getResponseData()

Get response data.

Parameters

\Psr\Http\Message\ResponseInterface $response: The response returned by the remote server.

Return value

array|string An array of data, parse from JSON, or a string.

3 calls to RemotePostWebformHandler::getResponseData()
RemotePostWebformHandler::debug in src/Plugin/WebformHandler/RemotePostWebformHandler.php
Display debugging information.
RemotePostWebformHandler::displayCustomResponseMessage in src/Plugin/WebformHandler/RemotePostWebformHandler.php
Display custom response message.
RemotePostWebformHandler::remotePost in src/Plugin/WebformHandler/RemotePostWebformHandler.php
Execute a remote post.

File

src/Plugin/WebformHandler/RemotePostWebformHandler.php, line 798

Class

RemotePostWebformHandler
Webform submission remote post handler.

Namespace

Drupal\webform\Plugin\WebformHandler

Code

protected function getResponseData(ResponseInterface $response) {
  $body = (string) $response
    ->getBody();
  $data = json_decode($body, TRUE);
  return json_last_error() === JSON_ERROR_NONE ? $data : $body;
}