/** * @param Gpf_Net_Http_Request $request * @return Gpf_Net_Http_Response * */ private function executeWithCurl(Gpf_Net_Http_Request $request) { $session = curl_init($request->getUrl()); if ($request->getMethod() == 'POST') { @curl_setopt($session, CURLOPT_POST, true); @curl_setopt($session, CURLOPT_POSTFIELDS, $request->getBody()); } $cookies = $request->getCookies(); if ($cookies) { @curl_setopt($session, CURLOPT_COOKIE, $cookies); } @curl_setopt($session, CURLOPT_HEADER, true); @curl_setopt($session, CURLOPT_CONNECTTIMEOUT, self::CONNECTION_TIMEOUT); @curl_setopt($session, CURLOPT_HTTPHEADER, $request->getHeaders()); @curl_setopt($session, CURLOPT_FOLLOWLOCATION, true); @curl_setopt($session, CURLOPT_RETURNTRANSFER, true); if ($request->getHttpPassword() != '' && $request->getHttpUser() != '') { @curl_setopt($session, CURLOPT_USERPWD, $request->getHttpUser() . ":" . $request->getHttpPassword()); @curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); } @curl_setopt($session, CURLOPT_SSL_VERIFYHOST, 0); @curl_setopt($session, CURLOPT_SSL_VERIFYPEER, 0); $this->setupCurlProxyServer($session, $request); // Make the call $result = curl_exec($session); $error = curl_error($session); curl_close($session); if (strlen($error)) { throw new Gpf_Exception("Curl error: " . $error); } $response = new Gpf_Net_Http_Response(); $response->setResponseText($result); return $response; }