public function send() { $config = $this->config; $env = $this->env; $options = [CURLOPT_URL => $this->getUrlWithParams(), CURLOPT_HEADER => false, CURLOPT_HTTPHEADER => $this->oAuth->createHeader($config, $env), CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false]; if (!empty($this->env->getPostParams())) { $postParams = $this->env->getPostParams(); $options[CURLOPT_POST] = count($postParams); $options[CURLOPT_POSTFIELDS] = $this->env->paramsToString($postParams); } $ch = curl_init(); curl_setopt_array($ch, $options); $response = curl_exec($ch); curl_close($ch); return $response; }
/** * Generate a url encoded request string containing the parameters. * * @return string */ protected function generateParamString() { $params = array_merge($this->env->getGetParams(), $this->env->getPostParams(), $this->getOAuthParams()); $params = $this->env->paramsToString($params); return rawurlencode($params); }