52,797
社区成员
发帖
与我相关
我的任务
分享
HttpWebRequest vReq = (HttpWebRequest) HttpWebRequest.Create("http://www.coldwellbankermove.com/property/PropertyResults.aspx");
vReq.Method = "POST"; //POST方法
//vReq.Method = "GET"; //GET方法
using (WebResponse vWR = vReq.GetResponse())
{
//在这里对接收到的页面内容进行处理
}
If (PostData <> String.Empty) Then
request.Method = "POST"
request.ContentType = "application/x-www-form-urlencoded"
Dim byteArray As Byte()
Dim NewLineIndex As Integer = PostData.IndexOf("\r\n")
If (NewLineIndex = -1) Then
byteArray = Encoding.UTF8.GetBytes(PostData)
Else
Dim NewPost As New Hashtable
While NewLineIndex <> -1
byteArray = Encoding.UTF8.GetBytes(PostData.Substring(0, NewLineIndex))
For i As Integer = 0 To byteArray.Length - 1
NewPost(NewPost.Count) = byteArray(i)
Next
PostData = PostData.Substring(NewLineIndex + 4, PostData.Length - NewLineIndex - 4)
NewPost(NewPost.Count) = 13
NewPost(NewPost.Count) = 10
NewLineIndex = PostData.IndexOf("\r\n")
End While
byteArray = Encoding.UTF8.GetBytes(PostData)
For i As Integer = 0 To byteArray.Length - 1
NewPost(NewPost.Count) = byteArray(i)
Next
Dim byteArrayTem(NewPost.Count - 1) As Byte
For i As Integer = 0 To byteArrayTem.Length - 1
byteArrayTem(i) = NewPost(i)
Next
byteArray = byteArrayTem
End If
request.ContentLength = byteArray.Length
'post
Dim newStream As Stream = request.GetRequestStream()
newStream.Write(byteArray, 0, byteArray.Length)
newStream.Flush()
newStream.Close()
End If
string postData = "searchID=35677";
postData += "&pageNumber=1";
postData += "&maxListingsPerPage=10";
postData += "&sortColumn=0";
postData += "&sourceID=-1";
postData += "&displayMode=0";
postData += "&bIsConsumerSearch=false";
postData += "&dtSince=";
byte[] data = encoding.GetBytes(postData);
HttpWebRequest myRequest =
(HttpWebRequest)WebRequest.Create("http://www.coldwellbankermove.com/property/PropertyResults.aspx");
myRequest.Method = "POST";
myRequest.ContentType = "application/x-www-form-urlencoded";
myRequest.ContentLength = data.Length;
Stream newStream = myRequest.GetRequestStream();
//Send the data.
newStream.Write(data, 0, data.Length);
newStream.Close();