setHttpUser() public method

public setHttpUser ( $user )
Exemplo n.º 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));
 }