Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function PostHTTPWebrequest(byval URL as string, byval PostData as string) as string
- Dim encoding As New System.Text.UTF8Encoding
- Dim byteData As Byte() = encoding.GetBytes(postdata)
- Dim request As System.Net.HttpWebRequest
- request = DirectCast(Net.HttpWebRequest.Create(URL), Net.HttpWebRequest)
- request.Method = "POST"
- request.ContentType = "application/x-www-form-urlencoded"
- request.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2.3) Gecko/20100401 Firefox/4.0 (.NET CLR 3.5.30729)"
- request.ContentLength = byteData.Length
- Dim postreqstream As System.IO.Stream = request.GetRequestStream()
- postreqstream.Write(byteData, 0, byteData.Length)
- postreqstream.Close()
- Dim response As System.Net.HttpWebResponse
- response = DirectCast(request.GetResponse(), Net.HttpWebResponse)
- Dim postreqreader As New System.IO.StreamReader(response.GetResponseStream())
- PostHTTPWebrequest = postreqreader.ReadToEnd
- End function
Advertisement
Add Comment
Please, Sign In to add comment