HttpWebRequest传查询条件到其他网站查询
用 HttpWebRequest传查询条件到其他网站查询(http://www.uuxoo.com/violat/query),获取返回页面,试过百度可以,但这个网站不行,不能地址传参数!!!就是调用这个网站的查违章功能
HttpWebRequest,提交数据
------解决方案--------------------System.Net.HttpWebRequest wr = (System.Net.HttpWebRequest)System.Net.WebRequest.Create("http://www.uuxoo.com/violat/query");
wr.Accept = "*/*"; //接受任意文件
wr.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.1.4322)"; // 模拟使用IE在浏览
wr.AllowAutoRedirect = true;//是否允许302
wr.Referer = "http://www.uuxoo.com/violat/query"; //当前页面的引用
System.Net.HttpWebResponse wrs = (System.Net.HttpWebResponse)wr.GetResponse();
System.IO.Stream sw = wrs.GetResponseStream();
System.IO.StreamReader sr = new System.IO.StreamReader(sw, System.Text.Encoding.UTF8);
Response.Write(sr.ReadToEnd());
sr.Close();
sr.Dispose();
------解决方案--------------------http://www.uuxoo.com/violat/query
-----------------------------215492619225726
Content-Disposition: form-data; name="vehicle_reg_no"
NB100
-----------------------------215492619225726
Content-Disposition: form-data; name="vehicle_id_no"
128372
-----------------------------215492619225726
Content-Disposition: form-data; name="formhash"
0663c78a
-----------------------------215492619225726
Content-Disposition: form-data; name="have_submit"
yes
-----------------------------215492619225726
Content-Disposition: form-data; name="submit"
1
-----------------------------215492619225726
Content-Disposition: form-data; name="vehicle_area"
èμ£
-----------------------------215492619225726
Content-Disposition: form-data; name="vehicle_type"
02
-----------------------------215492619225726--
这个不知道可不可以帮到你
------解决方案--------------------
static CookieContainer cookies = new CookieContainer();
public static string PostData(string url, string postDate, string refererUrl)
{
string html;
try
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
&