400-6988-358
当前位置:首页 > 服务支持 > API
专业的cdn服务提供商

API

通过调用刷新API,网站更新的内容将在第一时间被推送到缓存服务器,访客可以及时获取最新信息。为了及时推送您网站更新的内容,我们分别提供与JAVA、PHP、ASP、.NET对应API刷新接口,相关技术和API下载地址,请看具体说明。

  • JAVA使用说明

    lib下的jar包为远程调用API接口


    Test.java是测试例子。下面是demo介绍:

    rpcRefresh 单个页面刷新函数;rpcRefreshList 批量页面刷新函数

        /**
                 * @description 刷新单个url,例如:www.powercdn.com
                 * @param url 指定要刷新的URL地址
                 * @return 返回结果:True 刷新成功;False 刷新失败
                 */
                public boolean rpcRefresh(String url){
                    return execute("cache.refresh", new Object[]{urls});
                }
        /**
                 * @description 批量刷新urls,例如:new String[]{"www.3jia5.com","www.powercdn.com"}
                 * @param urls 指定要刷新的URL地址的数组
                 * @return 返回结果:True 刷新成功;False 刷新失败
                 */
                public boolean rpcRefreshList(List urls){
                    return execute("cache.refreshList", new Object[]{urls.toArray()});
                }
                点击"下载",下载API接口及使用案例。

    下载

  • PHP使用说明

    Xmlrpc.php是远程调用的API接口


    est.php是测试例子。下面是demo介绍:

    rpcRefresh 单个页面刷新函数;rpcRefreshList 批量页面刷新函数

        /*
         * 单条刷新网址 例如:www.powercdn.com
         * $url 指定要刷新的URL地址
         * 返回结果:True 刷新成功;False 刷新失败
         */
        function  rpcRefresh($url){
            $this->rpcRefreshRpc($url);
        }
        /*
         * 批量刷新网址 例如:array("www.3jia5.com","www.powercdn.com")
         * $url 指定要刷新的URL地址的数组
         * 返回结果:True 刷新成功;False 刷新失败
         */
        function  rpcRefreshList($url){
            $this->rpcRefreshRpc(array($url,"array"));
        }
        点击"下载",下载API接口及使用案例。

    下载

  • ASP使用说明

    cdnrpc.asp是远程调用API接口


    test.asp是测试例子。下面是demo介绍:

        /* 
         * 同步刷新单个页面,以"http://www.powercdn.com/product.shtml"为例
         */
        Response.Write "刷新页面: http://www.powercdn.com/product.shtml"
        res = rpcRefresh("http://www.powercdn.com/product.shtml")
        Response.Write "结果: "&res&""
        
        /* 
         * 异步刷新多个页面
         */
        urls(0) = "http://www.powercdn.com/service.shtml"
        urls(1) = "http://www.powercdn.com/product.shtml"
        urls(2) = "http://www.powercdn.com/product.shtml"
        ress = rpcRefreshList(urls)
        Response.Write "刷新页面: 
            http://www.powercdn.com/product.shtml
            http://www.powercdn.com/service.shtml"
        Response.Write "结果: "&ress&""
        点击"下载",下载API接口及使用案例。

    下载

  • C#使用说明

    bin目录下的CookComputing.XmlRpcV2.dll


    Test.cs是c#.net的测试例子。下面是demo介绍:
        /// 刷新单个url 实现类
        /// 
        ///参数url:指定要刷新的URL地址
        /// 返回值bool:True 刷新成功;False 刷新失败
        public static bool rpcRefresh(string url)
        {
            try
            {
                TStateName betty = (TStateName)XmlRpcProxyGen.Create();
                betty.Url = Xmlrpcurl;
                betty.XmlEncoding = new System.Text.UTF8Encoding();
                string usernamePassword = Username + ":" + Password;
        
                CredentialCache mycache = new CredentialCache();
                mycache.Add(new Uri(Xmlrpcurl), "Basic", new NetworkCredential(
                Username, Password));
        
                betty.Credentials = mycache;
                betty.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(
                new ASCIIEncoding().GetBytes(usernamePassword)));
        
                betty.refresh(url);
                return true;
            }
            catch (Exception ee)
            {
                return false;
            }
        }
        
        /// 批量刷新url 实现类
        /// 参数urls:指定要刷新的URL地址的数组
        /// 返回值bool:True 刷新成功;False 刷新失败
        public static bool rpcRefreshList(Object[] urls)
        {
            try
            {
                TStateNameList betty = (TStateNameList)XmlRpcProxyGen.Create();
                betty.Url = Xmlrpcurl;
                betty.XmlEncoding = new System.Text.UTF8Encoding();
                string usernamePassword = Username + ":" + Password;
        
                CredentialCache mycache = new CredentialCache();
                mycache.Add(new Uri(Xmlrpcurl), "Basic", new NetworkCredential(
                Username, Password));
        
                betty.Credentials = mycache;
                betty.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(
                new ASCIIEncoding().GetBytes(usernamePassword)));
        
                betty.refreshList(urls);
                return true;
            }
            catch (Exception ee)
            {
                System.Console.WriteLine(ee);
                return false;
            }
        }
    点击"下载",下载API接口及使用案例。

    下载

  • VB.NET使用说明

    bin目录下的CookComputing.XmlRpcV2.dll


    Test.vb是vb.net的测试例子。下面是demo介绍:

        ''' 刷新单个url
        ''' 参数url:指定要刷新的URL地址
        ''' 返回值Boolean:True 刷新成功;False 刷新失败
        Public Function RpcRefresh(ByVal Url As String) As Boolean
            Try
                Dim betty As TStateName = XmlRpcProxyGen.Create(Of TStateName)()
                betty.Url = Xmlrpcurl
                betty.XmlEncoding = New UTF8Encoding
                Dim mychche As CredentialCache = New CredentialCache()
        
                mychche.Add(New Uri(Xmlrpcurl), "Basic", New NetworkCredential(
                Username, Password))
        
                betty.Credentials = mychche
                betty.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(
                New ASCIIEncoding().GetBytes(UsernamePassword)))
        
                betty.refresh(Url)
        
                Return True
            Catch e As Exception
        
                Return False
        
            End Try
        
        End Function
        
        /// 批量刷新url 实现类
        /// 参数urls:指定要刷新的URL地址的数组
        /// 返回值bool:True 刷新成功;False 刷新失败
        ''' 批量刷新url
        ''' 参数urls:指定要刷新的URL地址的数组
        ''' 返回值Boolean:True 刷新成功;False 刷新失败
        Public Function RpcRefreshList(ByVal Urls As Object()) As Boolean
            Try
                Dim betty As TStateNameList = XmlRpcProxyGen.Create(Of TStateNameList)()
                betty.Url = Xmlrpcurl
                betty.XmlEncoding = New UTF8Encoding
                Dim mychche As CredentialCache = New CredentialCache()
        
                mychche.Add(New Uri(Xmlrpcurl), "Basic", New NetworkCredential(
                Username, Password))
        
                betty.Credentials = mychche
                betty.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(
                New ASCIIEncoding().GetBytes(UsernamePassword)))
        
                betty.refreshList(Urls)
        
                Return True
            Catch e As Exception
        
                Return False
        
            End Try
            
        End Function
        点击"下载",下载API接口及使用案例。
                

    下载