/**
  *
  * @throws CurlException
  */
 function send()
 {
     $body = curl_exec($this->handle);
     $info = curl_getinfo($this->handle);
     $this->response = $res = new $this->responseClass($body, $info);
     $errno = curl_errno($this->handle);
     if (0 !== $errno) {
         $err = new CurlException(curl_error($this->handle), $errno);
         $err->setRequest($this);
         $this->error = $err;
         throw $err;
     }
     return $res;
 }
Beispiel #2
0
 /**
  * @return string
  *
  * @throws CurlException
  */
 public function execute()
 {
     // This must always be set.
     $this->setOption(CURLOPT_RETURNTRANSFER, true);
     $result = curl_exec($this->curl);
     if ($result === false) {
         throw CurlException::error(curl_error($this->curl));
     }
     return $result;
 }
 /**
  * Sets all necessary dependencies
  */
 public function __construct()
 {
     $message = 'A file transfer was shorter or larger than expected';
     $code = 18;
     parent::__construct($message, $code);
 }
 /**
  * Sets all necessary dependencies
  */
 public function __construct()
 {
     $message = 'Character conversion failed';
     $code = 75;
     parent::__construct($message, $code);
 }
 /**
  * Sets all necessary dependencies
  */
 public function __construct()
 {
     $message = 'This was either a weird reply to a \'RETR\' command or a zero byte transfer complete';
     $code = 19;
     parent::__construct($message, $code);
 }
 /**
  * Sets all necessary dependencies
  */
 public function __construct()
 {
     $message = 'Invalid LDAP URL';
     $code = 62;
     parent::__construct($message, $code);
 }
 /**
  * Sets all necessary dependencies
  */
 public function __construct()
 {
     $message = 'Out of disk space on the server';
     $code = 70;
     parent::__construct($message, $code);
 }
 /**
  * Sets all necessary dependencies
  */
 public function __construct()
 {
     $message = 'A problem occurred somewhere in the SSL/TLS handshake';
     $code = 35;
     parent::__construct($message, $code);
 }
 /**
  * Sets all necessary dependencies
  */
 public function __construct()
 {
     $message = 'Initiating the SSL Engine failed';
     $code = 66;
     parent::__construct($message, $code);
 }
 /**
  * Sets all necessary dependencies
  */
 public function __construct()
 {
     $message = 'Failed to connect() to host or proxy';
     $code = 7;
     parent::__construct($message, $code);
 }
Beispiel #11
0
 /**
  * @param \Kdyby\Curl\CurlWrapper $curl
  * @param Request $request
  */
 public function __construct(CurlWrapper $curl, Request $request = NULL)
 {
     parent::__construct($curl->error . ' ' . $curl->getUrl()->getAuthority(), $request);
     $this->code = $curl->errorNumber;
     $this->info = $curl->info;
 }
 /**
  * Sets all necessary dependencies
  */
 public function __construct()
 {
     $message = 'Function not found. A required zlib function was not found.';
     $code = 41;
     parent::__construct($message, $code);
 }
 /**
  * Sets all necessary dependencies
  */
 public function __construct()
 {
     $message = 'The specified crypto engine wasn\'t found.';
     $code = 52;
     parent::__construct($message, $code);
 }
 /**
  * Sets all necessary dependencies
  */
 public function __construct()
 {
     $message = 'Http returned error';
     $code = 22;
     parent::__construct($message, $code);
 }
 /**
  * Sets all necessary dependencies
  */
 public function __construct()
 {
     $message = 'File not found on TFTP server';
     $code = 68;
     parent::__construct($message, $code);
 }
 /**
  * Sets all necessary dependencies
  */
 public function __construct()
 {
     $message = 'After having sent the FTP password to the server, libcurl expects a proper reply.';
     $code = 11;
     parent::__construct($message, $code);
 }
 /**
  * Sets all necessary dependencies
  */
 public function __construct()
 {
     $message = 'While waiting for the server to connect back when an active FTP session is used, ' . 'an error code was sent over the control connection or similar';
     $code = 10;
     parent::__construct($message, $code);
 }
 /**
  * Sets all necessary dependencies
  */
 public function __construct()
 {
     $message = 'Failed to shut down the SSL connection';
     $code = 80;
     parent::__construct($message, $code);
 }
 /**
  * Sets all necessary dependencies
  */
 public function __construct()
 {
     $message = 'The download could not be resumed because the specified offset was out of the file boundary.';
     $code = 36;
     parent::__construct($message, $code);
 }
 /**
  * Sets all necessary dependencies
  */
 public function __construct()
 {
     $message = 'Caller must register conversion callbacks';
     $code = 76;
     parent::__construct($message, $code);
 }
 /**
  * Sets all necessary dependencies
  */
 public function __construct()
 {
     $message = 'The URL was not properly formatted';
     $code = 3;
     parent::__construct($message, $code);
 }
 /**
  * Sets all necessary dependencies
  */
 public function __construct()
 {
     $message = 'A file given with FILE:// couldn\'t be opened';
     $code = 37;
     parent::__construct($message, $code);
 }
 /**
  * Sets all necessary dependencies
  */
 public function __construct()
 {
     $message = 'Peer certificate cannot be authenticated with known CA certificates.';
     $code = 60;
     parent::__construct($message, $code);
 }
Beispiel #24
0
 /**
  * @param CurlResponse $response The related response object.
  * @param string $message The error message.
  * @param integer $code The error code of the underlying curl resource.
  */
 public function __construct(CurlResponse $response, $message, $code)
 {
     $this->response = $response;
     parent::__construct($message, $code);
 }
 /**
  * Sets all necessary dependencies
  */
 public function __construct()
 {
     $message = 'Illegal TFTP operation';
     $code = 71;
     parent::__construct($message, $code);
 }
 /**
  * Sets all necessary dependencies
  */
 public function __construct()
 {
     $message = 'The URL you passed to libcurl used a protocol that this libcurl does not support';
     $code = 1;
     parent::__construct($message, $code);
 }
 /**
  * Sets all necessary dependencies
  */
 public function __construct()
 {
     $message = 'Failure with receiving network data';
     $code = 56;
     parent::__construct($message, $code);
 }
 /**
  * Sets all necessary dependencies
  */
 public function __construct()
 {
     $message = 'Issuer check failed';
     $code = 83;
     parent::__construct($message, $code);
 }
 /**
  * Sets all necessary dependencies
  */
 public function __construct()
 {
     $message = 'When doing a send operation curl had to rewind the data to retransmit, but the rewinding operation failed';
     $code = 65;
     parent::__construct($message, $code);
 }
 /**
  * Sets all necessary dependencies
  */
 public function __construct()
 {
     $message = 'Very early initialization code failed';
     $code = 2;
     parent::__construct($message, $code);
 }