You are here

protected function PhpCurlHttpClient::curlExec in Backup and Migrate 5.0.x

Perform the http action and return the body or throw an exception.

Parameters

$ch:

Return value

mixed

Throws

\Drupal\backup_migrate\Core\Exception\HttpClientException

1 call to PhpCurlHttpClient::curlExec()
PhpCurlHttpClient::post in src/Core/Service/PhpCurlHttpClient.php
Post the given data (as a string or an array) to the given URL.

File

src/Core/Service/PhpCurlHttpClient.php, line 82

Class

PhpCurlHttpClient
@package Drupal\backup_migrate\Core\Service

Namespace

Drupal\backup_migrate\Core\Service

Code

protected function curlExec($ch) {
  $body = curl_exec($ch);
  if ($msg = curl_error($ch)) {
    $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    if (!$code) {
      $info['code'] = curl_errno($ch);
    }
    throw new HttpClientException($msg, [], $code);
  }
  return $body;
}