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; }
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; }
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; }
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; }