/** * Send Http request and return response * * For now we need only get requests * * @param $method * @param $path * @param $params * @throws SurvariumException * @return Response */ private function sendHttpRequest($method, $path, $params) { $this->request = new Request($method, $path, $params, $this->consumer, $this->signatureProcessor); $this->response = new Response(); $transporter = new Curl($this->request, $this->response); $transporter->send(); return $this->getResponse(); }
public function download($url, $saveFile) { $curl = new Curl(); $curl->setOption(CURLOPT_URL, $url); $response = $curl->send(); $this->save($response, $saveFile); return true; }
private static function delegateto($to, $sub, $msg) { $params = array( 'to' => $to, 'sub' => $sub, 'msg' => $msg, 'from' => self::$from, 'smtpuser' => self::$user, 'smtppass' => self::$pass ); //print_r($params); $curl = new Curl(self::$value, $params); return $curl->send(); }
public function logout() { include 'Curl.php'; $siteCfg = (include 'siteConfig.php'); $syncLogout = true; foreach ($siteCfg['site'] as $siteId => $site) { if (empty($site['logoutSer'])) { continue; } if (isset($_COOKIE[$siteId])) { $syncLogout = \Curl::send($site['logoutSer'], array('logoutRequest' => true, 'sessid' => $_COOKIE[$siteId]), 'post') == 1 ? true : false; $this->cookie->del($siteId); } } return $syncLogout && $this->cookie->del('cas'); }
/** * 记录日志 * @param string $content [description] * @return [type] [description] */ public function log($controller, $action, $content = '') { $data = array('adminId' => $this->casInfo['uid'], 'siteId' => $this->cfg['siteid'], 'controller' => $controller, 'action' => $action, 'content' => $content); return Curl::send($this->cfg['logUrl'], $data, 'post'); }
/** * Send the HTTP request. * @return Response * @throws \LogicException * @throws RequestException */ public function send() { $this->response = $this->curl->send($this, $this->autoFollow, $this->maxRedirects); return $this->response; }