コード例 #1
0
ファイル: DirectAdmin.php プロジェクト: omines/directadmin
 /**
  * Sends a raw request to DirectAdmin.
  *
  * @param string $method
  * @param string $uri
  * @param array $options
  * @return array
  */
 private function rawRequest($method, $uri, $options)
 {
     try {
         $response = $this->connection->request($method, $uri, $options);
         if ($response->getHeader('Content-Type')[0] == 'text/html') {
             throw new DirectAdminException(sprintf('DirectAdmin API returned text/html to %s %s containing "%s"', $method, $uri, strip_tags($response->getBody()->getContents())));
         }
         $body = $response->getBody()->getContents();
         return Conversion::responseToArray($body);
     } catch (TransferException $exception) {
         // Rethrow anything that causes a network issue
         throw new DirectAdminException(sprintf('%s request to %s failed', $method, $uri), 0, $exception);
     }
 }