You are here

protected function PhpCurlHttpClient::curlExec in Backup and Migrate 8.4

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

Parameters

$ch:

Return value

mixed

Throws

\BackupMigrate\Core\Exception\HttpClientException

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

File

lib/backup_migrate_core/src/Service/PhpCurlHttpClient.php, line 82

Class

PhpCurlHttpClient
Class PhpCurlHttpClient.

Namespace

BackupMigrate\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;
}