params['client[username]'] = $apiConfig['apiUsername']; $this->params['client[password]'] = $apiConfig['apiPassword']; $this->params['client[domain]'] = ( ); } public function setKeyword( $keyword ) { if ( $keyword ) { $this->params['keyword'] = $keyword; } } public function generateCacheKey( $params ) { $str = ""; ksort( &$params ); foreach ( $params as $zym_2 => $zym_1 ) { $str .= $zym_2.$zym_1; } return md5( $str ); } public function execute( ) { $ReSp = NULL; $cacheKey = ""; if ( $this->cacheTime <= 0 ) { $this->cacheTime = 604800; } if ( 0 < $this->cacheTime ) { $this->cache = ( ); $cacheKey = $this->params( $this->params ); $ReSp = $this->cache->getIn( $this->cacheGroup, $cacheKey ); } if ( $ReSp === NULL ) { try { $ReSp = $this->params( base64_decode( "aHR0cDovL2FwaS44OTg4LmJpei9hcGkvdGFvYmFva2UvaXRlbVNlYXJjaA==" ), $this->params ); } catch ( Exception $? ) { $Result = new stdClass( ); $Result->errorCode = $a_list->getCode( ); $Result->errorMsg = $a_list->getMessage( ); return $Result; } $respObject = json_decode( $ReSp ); if ( NULL !== $respObject && ( !isset( $respObject->errorCode ) || intval( $respObject->errorCode ) == 0 ) && $this->cacheTime ) { $this->cache->setIn( $this->cacheGroup, $cacheKey, $respObject, $this->cacheTime ); return $respObject; } } $respObject = $ReSp; return $respObject; } public function curl( $url, $postFields = NULL ) { $ch = curl_init( ); curl_setopt( $ch, CURLOPT_URL, $url ); curl_setopt( $ch, CURLOPT_FAILONERROR, FALSE ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, TRUE ); if ( 5 < strlen( $url ) && strtolower( substr( $url, 0, 5 ) ) == "https" ) { curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, FALSE ); curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, FALSE ); } if ( is_array( $postFields ) && 0 < count( $postFields ) ) { $postBodyString = ""; $postMultipart = FALSE; foreach ( $postFields as $append_editor => $ConfigControllerComponentCancel ) { if ( "@" != substr( $ConfigControllerComponentCancel, 0, 1 ) ) { $postBodyString .= "{$append_editor}=".urlencode( $ConfigControllerComponentCancel )."&"; } else { $postMultipart = TRUE; } } unset( $ ); unset( $ ); curl_setopt( $ch, CURLOPT_POST, TRUE ); if ( $postMultipart ) { curl_setopt( $ch, CURLOPT_POSTFIELDS, $postFields ); } else { curl_setopt( $ch, CURLOPT_POSTFIELDS, substr( $postBodyString, 0, -1 ) ); } } $reponse = curl_exec( $ch ); if ( curl_errno( $ch ) ) { throw new Exception( curl_error( $ch ), 0 ); } $httpStatusCode = curl_getinfo( $ch, CURLINFO_HTTP_CODE ); if ( 200 !== $httpStatusCode ) { throw new Exception( $reponse, $httpStatusCode ); } curl_close( $ch ); return $reponse; } } ( "Mil" ); ( "MilConfig" ); ?>