Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Function SendData(ByVal PostData As String, ByVal Site As String) As String
- Dim Request As HttpWebRequest = DirectCast(WebRequest.Create(Site), HttpWebRequest)
- Request.Method = "POST"
- Request.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)"
- Request.ContentType = "application/x-www-form-urlencoded"
- Request.AllowAutoRedirect = True
- Request.ServicePoint.Expect100Continue = False
- Request.ContentLength = PostData.Length
- Using ReqStream As Stream = Request.GetRequestStream()
- Dim Encoding As New UTF8Encoding()
- Dim PostBytes As Byte() = Encoding.GetBytes(PostData)
- ReqStream.Write(PostBytes, 0, PostBytes.Length)
- End Using
- Dim Result As String = String.Empty
- Using Response As HttpWebResponse = Request.GetResponse()
- Using RespStream As Stream = Response.GetResponseStream()
- Using Reader As New StreamReader(RespStream)
- Result = Reader.ReadToEnd()
- End Using
- End Using
- End Using
- Return Result
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement