The definition of the http data header is not written here.
Of course, the definition of the header can be written in this way.
Dim head As WebHeaderCollection
Head. Add ("name", "value ")
Send. Headers = head
Well, let's go to the topic. Below is a class, and a stream is received, which makes it easy to use! Imports System. Net
Imports System. io
Public Class httpClass http
Public Function httpsend () Function httpsend (ByVal uri As String, ByVal method As String, ByVal content As String) As Stream
Dim send As WebRequest = WebRequest. Create (uri)
Send. Method = method
Dim postdata As Byte ()
Postdata = System. Text. Encoding. Default. GetBytes (content)
Send. ContentLength = postdata. Length
Dim postStream As Stream = send. GetRequestStream ()
PostStream. Write (postdata, 0, postdata. Length)
PostStream. Close ()
Dim re As WebResponse = send. GetResponse
Return re. GetResponseStream
End Function
End Class
The corresponding receiving page can be written in the LOAD event as follows:
If Not IsDBNull (Request) Then
Dim a As Stream = Request. InputStream
End if