コード例 #1
0
 /**
  * @service banner read
  * @param $bannerId
  * @return Gpf_Rpc_Action
  */
 public function check(Gpf_Rpc_Params $params) {
     $response = new Gpf_Rpc_Action($params);
     $bannerFactory = new Pap_Common_Banner_Factory();
     $site = $bannerFactory->getBanner($params->get('id'));
     $site->setDestinationUrl(rtrim($params->get('url'), "/\\").'/');
     
     $response->setInfoMessage('Site replication .htaccess is working at this location');
     $response->setErrorMessage('Site replication .htaccess is not set up at this location or it is not working correctly. Please make sure that you have mod_rewrite and mod_proxy enabled in your Apache configuration');
     
     $testUser = new Pap_Common_User();
     $testUser->setRefId(Pap_Features_SiteReplication_Replicator::TEST_STRING);
     $request = new Gpf_Net_Http_Request();
     $request->setUrl($site->getUrl($testUser).Pap_Features_SiteReplication_Replicator::TEST_STRING);
     $httpClient = new Gpf_Net_Http_Client();
     try {
         $testResponse = $httpClient->execute($request);
         if ($testResponse->getBody() == Pap_Features_SiteReplication_Replicator::TEST_RESPONSE) {
             $response->addOk();
         } else {
             $response->addError();                
         }
     } catch (Gpf_Exception $e) {
         $response->addError();
     }
     
     return $response;
 }
コード例 #2
0
 protected function sendRequest($requestBody)
 {
     $request = new Gpf_Net_Http_Request();
     $request->setMethod('POST');
     $request->setBody(Gpf_Rpc_Server::BODY_DATA_NAME . '=' . urlencode($requestBody));
     $request->setUrl($this->url);
     $client = new Gpf_Net_Http_Client();
     $response = $client->execute($request);
     return $response->getBody();
 }
コード例 #3
0
ファイル: Whm.class.php プロジェクト: AmineCherrai/rostanvo
 /**
  * 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));
 }
コード例 #4
0
    private function loadContent() {
        $getString = $this->encodeArray($_GET);
        if ($getString != '') {
            $getString = '?' . $getString;
        }

        $request = new Gpf_Net_Http_Request();
        $request->setUrl($this->getReplicatedSiteRealUrl() . $this->fileName . $getString);
        $request->setCookies($_COOKIE);

        if (count($_POST) > 0) {
            $request->setMethod('POST');
            $request->setBody($this->encodeArray($_POST));
        }

        $client = new Gpf_Net_Http_Client();
        $this->contentResponse = $client->execute($request);
    }
コード例 #5
0
 protected function sendRequest(Gpf_Net_Http_Request $request)
 {
     $client = new Gpf_Net_Http_Client();
     return $client->execute($request);
 }
コード例 #6
0
 /**
  * @param string $url
  * @return Gpf_Gadget
  */
 public function downloadGadget($url)
 {
     if (strpos($url, self::CONTENT_PREFFIX) === 0) {
         Gpf_Log::debug($this->_sys("Adding content gadget: %s", $url));
         $gadget = new Gpf_Gadget_Content();
         $gadget->setUrl($url);
         $gadget->loadConfiguration("");
         return $gadget;
     } else {
         Gpf_Log::debug($this->_sys("Downloading gadget: %s", $url));
         $request = new Gpf_Net_Http_Request();
         $request->setUrl($url);
         $client = new Gpf_Net_Http_Client();
         $response = $client->execute($request);
         $gadgetContent = $response->getBody();
         foreach ($this->gadgetTypes as $className) {
             $gadget = Gpf::newObj($className);
             $gadget->setUrl($url);
             try {
                 $gadget->loadConfiguration($gadgetContent);
                 return $gadget;
             } catch (Gpf_Exception $e) {
             }
         }
         throw new Gpf_Exception($this->_("Unsupported gadget"));
     }
 }
コード例 #7
0
    protected function readXmlData() {

        $request = new Gpf_Net_Http_Request();
        $request->setMethod('POST');
        $request->setUrl('https://www.secureinfossl.com/api/getOrderInfo.html');
        $request->setBody('merchantid=' . urlencode(Gpf_Settings::get(PremiumWebCart_Config::MERCHANT_ID))
        . '&signature=' . urlencode(Gpf_Settings::get(PremiumWebCart_Config::API_SIGNATURE))
        . '&orderid='.$_GET['order_unique_id']);

        $client = new Gpf_Net_Http_Client();
        $input = $client->execute($request)->getBody();
        $this->debug("Input get: " . $input);
        //echo $input;
        try {
            $xml = new SimpleXMLElement($input);
        } catch (Exception $e) {
            $this->setPaymentStatus("Failed");
            $this->debug('Wrong XML format.');
        }

        $this->xml = $xml;
    }