Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Function POSTRequest(ByVal URL As String, ByVal Data As String) As String
- Dim req As HttpWebRequest = DirectCast(WebRequest.Create(URL), HttpWebRequest)
- req.ContentType = "application/x-www-form-urlencoded"
- req.Method = "POST"
- Dim postData As String = Data
- Dim postBytes As Byte() = Encoding.UTF8.GetBytes(postData)
- req.ContentLength = postBytes.Length
- Dim reqStream As Stream = req.GetRequestStream()
- reqStream.Write(postBytes, 0, postBytes.Length)
- reqStream.Close()
- Dim resp As HttpWebResponse = DirectCast(req.GetResponse(), HttpWebResponse)
- Dim respText As String = New StreamReader(resp.GetResponseStream(), Encoding.UTF8).ReadToEnd()
- Return respText
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement