分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow
也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!
public void PostMoths() { string strURL = "http://www.cqjg.gov.cn/newwww/c7/clwz.asp"; System.Net.HttpWebRequest request; request = (System.Net.HttpWebRequest)WebRequest.Create(strURL); //Post请求方式 request.Method = "POST"; //内容类型 request.ContentType = "application/x-www-form-urlencoded"; //参数经过URL编码 string paraUrlCoded = System.Web.HttpUtility.UrlEncode("LicenseTxt"); paraUrlCoded += "=" + System.Web.HttpUtility.UrlEncode(txtCarId .Text.Trim()); paraUrlCoded +="& "+ System.Web.HttpUtility.UrlEncode("VIN"); paraUrlCoded += "=" + System.Web.HttpUtility.UrlEncode(txtCarNumber.Text.Trim()); byte[] payload; //将URL编码后的字符串转化为字节 payload = System.Text.Encoding.UTF8.GetBytes(paraUrlCoded); //设置请求的ContentLength request.ContentLength = payload.Length; //获得请求流 Stream writer = request.GetRequestStream(); //将请求参数写入流 writer.Write(payload, 0, payload.Length); //关闭请求流 writer.Close(); System.Net.HttpWebResponse response; //获得响应流 response = (System.Net.HttpWebResponse)request.GetResponse(); System.IO.Stream s; s = response.GetResponseStream(); string StrDate = ""; string strValue = ""; StreamReader Reader = new StreamReader(s,Encoding.Default); while ((StrDate= Reader.ReadLine())!=null) { strValue += StrDate+"\r\n"; } // txtInfo.Text = strValue; txtInfo.Text= FindContent(strValue); //XmlTextReader Reader = new XmlTextReader(s); //Reader.MoveToContent(); //string strValue = Reader.ReadInnerXml(); //strValue = strValue.Replace("<", "<"); //strValue = strValue.Replace(">", ">"); //MessageBox.Show(strValue); //Reader.Close(); }