Example #1
0
 function Execute()
 {
     $this->SetOption(CURLOPT_URL, $this->BuildUrl());
     if ($this->method->Equals(Http\RequestMethod::Post())) {
         if (count($this->postParams) > 0) {
             $this->SetOption(CURLOPT_POSTFIELDS, $this->postParams);
         } else {
             $this->SetOption(CURLOPT_POSTFIELDS, $this->postData);
         }
     }
     $this->SetHeaders();
     $result = curl_exec($this->ch);
     $errNo = $this->GetErrorNo();
     if ($errNo) {
         throw new \Exception($this->GetError(), $errNo);
     }
     return $result;
 }
Example #2
0
 /**
  * Gets the current request method
  * @return RequestMethod
  */
 static function Method()
 {
     return RequestMethod::FromString(Server::Variable('REQUEST_METHOD'));
 }
Example #3
0
 /**
  * Gets the http method for the form; can be overridden for GET forms
  * @return RequestMethod The HTTP method of the form (post or get)
  */
 protected function Method()
 {
     return RequestMethod::Post();
 }