vb.net获取网页的简单示例
Private Function getSourceHtml() As String
Dim result As String = ""
Try
Dim i As Integer = Int(Rnd(Now.Second) * 10 + 1)
Dim web As New System.Net.WebClient()
web.Headers.Add("Content-Type", "application/x-www-form-urlencoded")
Dim d As Byte() = System.Text.Encoding.UTF8.GetBytes("method=copy&u=123&p=123")
Dim res As Byte() = web.UploadData("www.junjv.com", "POST", d)
result = Encoding.UTF8.GetString(res)
Catch ex As Exception
'MsgBox(ex.Message)
End Try
Return result
End Function
Dim result As String = ""
Try
Dim i As Integer = Int(Rnd(Now.Second) * 10 + 1)
Dim web As New System.Net.WebClient()
web.Headers.Add("Content-Type", "application/x-www-form-urlencoded")
Dim d As Byte() = System.Text.Encoding.UTF8.GetBytes("method=copy&u=123&p=123")
Dim res As Byte() = web.UploadData("www.junjv.com", "POST", d)
result = Encoding.UTF8.GetString(res)
Catch ex As Exception
'MsgBox(ex.Message)
End Try
Return result
End Function
等于http://www.junjv.com/?method=copy&u=123&p=123