|
连接:http://202.114.153.37/zkb/bkcx/bkcx.asp?database=bk201407&showlx=11
号码:014614110881
这是使用你的Helper类实现的,但是不行。
string url = "http://202.114.153.37/zkb/bkcx/cjlist.asp";
string data = "showlx=&database=bk201407&tkz=" + number + "&B1=%CC%E1%BD%BB";
Encoding gb2312 = Encoding.GetEncoding("GB2312");
HttpResult result = httpHelper.GetHtml(new HttpItem()
{
URL = "http://202.114.153.37/zkb/bkcx/cjlist.asp",
Postdata=data
});
后来我自己写了一个方法,但是值没有传递进去
string requestString = "showlx=&database=bk201407&tkz=" + number + "&B1=%CC%E1%BD%BB";
System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(url);
request.Method = "POST";
request.ContentLength = requestString.Length;
request.ContentType = "text/xml";
gb2312 = Encoding.GetEncoding("gb2312");
byte[] bytes = Encoding.Default.GetBytes(requestString);
System.IO.Stream stream = request.GetRequestStream();
stream.Write(bytes, 0, bytes.Length);
stream.Close();
System.Net.HttpWebResponse response;
System.IO.StreamReader streamReader;
response = (System.Net.HttpWebResponse)request.GetResponse();
streamReader = new StreamReader(response.GetResponseStream(), gb2312);
StringBuilder sb = new StringBuilder();
char[] respChar = new char[1024];
int BytesRead = 0;
BytesRead = streamReader.Read(respChar, 0, 1024);
while (BytesRead > 0)
{
sb.Append(respChar, 0, BytesRead);
BytesRead = streamReader.Read(respChar, 0, 1024);
}
streamReader.Close();
只需要值post进去就好了。
|
|