Private Function httpPost(ByVal content As String, ByVal url As String) As String
Try
Dim sPostData As String = content '要post的内容
Dim ByteArray As Byte() = System.Text.Encoding.UTF8.GetBytes(sPostData) 'utf8
Dim hwRequest As HttpWebRequest = WebRequest.Create(url) '发送到的运程地址
hwRequest.Method = "POST"
hwRequest.ContentType = "application/x-www-form-urlencoded"
hwRequest.ContentLength = ByteArray.Length
Dim newStream As Stream = hwRequest.GetRequestStream()
newStream.Write(ByteArray, 0, ByteArray.Length)
newStream.Close()
'获得响应
Dim response As HttpWebResponse = hwRequest.GetResponse
newStream = response.GetResponseStream
Dim reader As New StreamReader(newStream)
Dim str As String = reader.ReadToEnd '响应字符串
reader.Close()
newStream.Close()
response.Close()
Return str
Catch ex As Exception
Return ex.Message
End Try
End Function