Beispiel #1
0
        /// <summary>
        /// 获取证书编号对应详情
        /// </summary>
        /// <param name="Certi_No"></param>
        private Dictionary <String, String> CQC_Details(String Certi_No)
        {
            Dictionary <String, String> dirs = new Dictionary <string, string>();
            HttpInfo info   = new HttpInfo();
            String   html   = "start";
            String   code   = String.Empty;
            String   cookie = Get_Cookie(CQC_Details_Url);

            try
            {
                while (!html.Contains(Certi_No) || html.Contains("验证码输入有误") || html.Contains("请输入验证码"))
                {
                    code            = WmCodeHelper.Get_Code(cookie);
                    info.RequestUrl = CQC_Details_Url;
                    info.PostData   = String.Format(CQC_PostData, Certi_No, code);
                    info.Cookie     = new CookieString(cookie, true);
                    //info.Ip = "";
                    html = HttpMethod.HttpWork(info);
                    Thread.Sleep(1);
                }
                if (html.Contains(Certi_No))
                {
                    //数据处理
                    var    ths   = XpathMethod.GetMutResult(xpath_title, html, 1);
                    var    strs  = XpathMethod.GetMutResult(xpath_certi, html, 1);
                    string fjurl = XpathMethod.GetSingleResult(xpath_certi + "[14]", html, 0);
                    fjurl = RegexMethod.GetSingleResult(reg_fjurl, fjurl, 1);
                    for (int i = 1; i < strs.Count; i++)
                    {
                        if (i == strs.Count - 1 && !String.IsNullOrEmpty(fjurl))
                        {
                            dirs.Add(ths[i], fjurl);
                        }
                        else
                        {
                            dirs.Add(ths[i], strs[i]);
                        }
                    }
                    //CCCInfo cccinfo = new CCCInfo();
                    //cccinfo.CertiNo = XpathMethod.GetSingleResult(xpath_certino, html);
                    //cccinfo.Applicant = XpathMethod.GetSingleResult(xpath_appli1, html) + "\r\n" + XpathMethod.GetSingleResult(xpath_appli2, html);
                }
            }
            catch
            {
            }
            return(dirs);
        }
Beispiel #2
0
        /// <summary>
        /// 获取验证码
        /// </summary>
        /// <returns></returns>
        public static string Get_Code(string cookie)
        {
            String code = String.Empty;

            try
            {
                while (code.Length != 4)
                {
                    code = WmCodeHelper.WmCodeAndGetCode(Code_Url, cookie);
                    Thread.Sleep(1);
                }
            }
            catch
            {
            }
            return(code);
        }