當前位置: 首頁>>代碼示例>>PHP>>正文


PHP HttpClient::fetchContents方法代碼示例

本文整理匯總了PHP中HttpClient::fetchContents方法的典型用法代碼示例。如果您正苦於以下問題:PHP HttpClient::fetchContents方法的具體用法?PHP HttpClient::fetchContents怎麽用?PHP HttpClient::fetchContents使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在HttpClient的用法示例。


在下文中一共展示了HttpClient::fetchContents方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: _remoteCall

 protected function _remoteCall($method, $params = null)
 {
     $uri = $this->reportServer;
     $cache_id = md5($this->objectName . $uri . $method . serialize($params));
     $cacheSvc = Openbiz::getService(CACHE_SERVICE, 1);
     $cacheSvc->init($this->objectName, $this->cacheLifeTime);
     if (substr($uri, strlen($uri) - 1, 1) != '/') {
         $uri .= '/';
     }
     $uri .= "ws.php/udc/CollectService";
     if ($cacheSvc->test($cache_id) && (int) $this->cacheLifeTime > 0) {
         $resultSetArray = $cacheSvc->load($cache_id);
     } else {
         try {
             $argsJson = urlencode(json_encode($params));
             $query = array("method={$method}", "format=json", "argsJson={$argsJson}");
             $httpClient = new HttpClient('POST');
             foreach ($query as $q) {
                 $httpClient->addQuery($q);
             }
             $headerList = array();
             $out = $httpClient->fetchContents($uri, $headerList);
             $cats = json_decode($out, true);
             $resultSetArray = $cats['data'];
             $cacheSvc->save($resultSetArray, $cache_id);
         } catch (Exception $e) {
             $resultSetArray = array();
         }
     }
     return $resultSetArray;
 }
開發者ID:openbizx,項目名稱:openbizx-cubix,代碼行數:31,代碼來源:ErrorReportService.php

示例2: testSvc

function testSvc($url, $query = null, $cookie = null)
{
    $httpClient = new HttpClient('POST');
    $httpClient->setCookie($cookie);
    foreach ($query as $q) {
        $httpClient->addQuery($q);
    }
    $headerList = array();
    $out = $httpClient->fetchContents($url, $headerList, false);
    return $out;
}
開發者ID:Why-Not-Sky,項目名稱:cubi-ng,代碼行數:11,代碼來源:pkg_test.php

示例3: acquireLicense

 public function acquireLicense($activationCode, $contactEmail, $serverData)
 {
     //try to process cache service.
     $argsJson = json_encode(array("activation_code" => $activationCode, "contact_email" => $contactEmail, "server_data" => $serverData));
     $query = array("method=acquireLicense", "format=json", "argsJson={$argsJson}");
     $httpClient = new HttpClient('POST');
     foreach ($query as $q) {
         $httpClient->addQuery($q);
     }
     $headerList = array();
     $out = $httpClient->fetchContents($this->repositoryUrl, $headerList);
     echo $out;
     $lic = json_decode($out, true);
     $licenseArray = $lic['data'];
     return $licenseArray;
 }
開發者ID:openbizx,項目名稱:openbizx-cubix,代碼行數:16,代碼來源:licenseClient.php

示例4: GetSystemUUIDfromRemote

 public function GetSystemUUIDfromRemote()
 {
     $method = "CetSystemUUID";
     if (function_exists("ioncube_server_data")) {
         $system_server_data = ioncube_server_data();
     } else {
         $system_server_data = "";
     }
     $params = array("system_server_data" => $system_server_data);
     $argsJson = urlencode(json_encode($params));
     $query = array("method={$method}", "format=json", "argsJson={$argsJson}");
     $httpClient = new HttpClient('POST');
     foreach ($query as $q) {
         $httpClient->addQuery($q);
     }
     $headerList = array();
     $out = $httpClient->fetchContents($this->m_UDC_Server, $headerList);
     $cats = json_decode($out, true);
     $result = $cats['data'];
     if ($result) {
         $dataFile = APP_HOME . '/files/system_uuid.data';
         file_put_contents($dataFile, $result);
     }
     return $result;
 }
開發者ID:Why-Not-Sky,項目名稱:cubi-ng,代碼行數:25,代碼來源:CubiService.php


注:本文中的HttpClient::fetchContents方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。