Beispiel #1
0
        internal string select(string HostRecord, out string RecordId, out string log)
        {
            string ip = null; RecordId = ""; log = "";

            GetPostString.RequestString requestString = new GetPostString.RequestString();
            requestString.InitializeDict(AccessKeyId);
            requestString.DictData.Add("Action", "DescribeDomainRecords");
            requestString.DictData.Add("DomainName", MY_ID.DomainName);
            requestString.Signature(AccessKeySecret);
            string HttpGetString = requestString.Serialization();

            log          += "请求网址=\n" + HttpGetString + "\n\n请求返回=\n";
            HttpGetString = CreateGetHttpResponse("http://alidns.aliyuncs.com/?" + HttpGetString);
            log          += HttpGetString + "\n\n";
            try
            {
                int left = HttpGetString.IndexOf($"\"RR\":\"{HostRecord}\"");
                log     += "第一层left=" + left;
                left     = HttpGetString.IndexOf("\"Value\":\"", left);
                log     += "\n第二层left=" + left + "\n当前解析IP = ";
                ip       = HttpGetString.Substring(left + 9, HttpGetString.IndexOf("Weight", left) - left - 12);
                log     += ip;
                left     = HttpGetString.IndexOf("RecordId", left);
                log     += "\n第三层left=" + left + "\n当前解析ID = ";
                RecordId = HttpGetString.Substring(left + 11, HttpGetString.IndexOf(",", left) - left - 12);
                log     += RecordId;
            }
            catch (Exception)
            {
            }
            return(ip);
        }
Beispiel #2
0
        internal void update(string IP, string RecordId, out string log)
        {
            log = "";
            GetPostString.RequestString requestString = new GetPostString.RequestString();
            requestString.InitializeDict(AccessKeyId);
            requestString.DictData.Add("Action", "UpdateDomainRecord");
            requestString.DictData.Add("RecordId", RecordId);
            requestString.DictData.Add("RR", MY_ID.HostRecord);
            requestString.DictData.Add("Type", "A");
            requestString.DictData.Add("Value", IP);
            requestString.DictData.Add("TTL", "600");
            requestString.Signature(AccessKeySecret);
            string HttpGetString = requestString.Serialization();
            string Return        = CreateGetHttpResponse("http://alidns.aliyuncs.com/?" + HttpGetString);

            log += RecordId;
        }