Gpf_Net_Http_Request::toString PHP Method

toString() public method

public toString ( )
        public function toString()
        {
            $this->initHeaders();
            $out = sprintf('%s %s HTTP/1.0' . self::CRLF, $this->getMethod(), $this->getUri());
            $out .= implode(self::CRLF, $this->getHeaders()) . self::CRLF . $this->getCookiesHeader() . self::CRLF;
            $out .= self::CRLF . $this->getBody();
            return $out;
        }

Usage Example

Beispiel #1
0
 /**
  * Execute request to CPanel
  *
  * @param $path CPanel command path
  * @param $params Array of parameters, which input to CPanel command
  * @return SimpleXMLElement
  */
 protected function execute($path, $params = array())
 {
     $client = new Gpf_Net_Http_Client();
     $request = new Gpf_Net_Http_Request();
     $url = ($this->useSsl ? 'https://' : 'http://') . $this->host . ':' . $this->port . $path;
     Gpf_Log::info('Request URL: ' . $url);
     $query = '';
     foreach ($params as $name => $value) {
         $query .= '&' . $name . '=' . urlencode($value);
     }
     Gpf_Log::info('Request params: ' . $query);
     $request->setUrl($url . (strlen($query) ? '?' : '') . ltrim($query, '&'));
     $request->setHttpUser($this->user);
     $request->setHttpPassword($this->passwd);
     Gpf_Log::info("Executing HTTP request: " . $request->toString());
     return $this->parseResult($client->execute($request));
 }
All Usage Examples Of Gpf_Net_Http_Request::toString