/** * returns a longer error string to be used in generic exceptions * * It returns a "nicely" formatted URI of the request * plus the output of curl_getinfo * plus the response body including its size * * @param curl $curl The curl object * @param string $response the response body * @return string the error message */ protected function getLongErrorString($curl, $response) { $string = $this->getShortErrorString(); $string .= "--curl getinfo: --\n" . var_export($curl->getinfo(), true) . "\n"; $string .= "--request body (size: " . strlen($this->body) . " bytes): --\n"; if (strlen($this->body) > 2000) { $string .= substr($this->body, 0, 2000); $string .= "\n (truncated)\n"; } else { $string .= $this->body . "\n"; } $string .= "--response body (size: " . strlen($response) . " bytes): --\n{$response}\n--end response body--\n"; return $string; }
/** * {@inheritDoc} */ public function logout() { if (!empty($this->curl)) { $this->curl->close(); } $this->curl = false; }