I'm coding in vb.net, and I haven't in forever so I'm a littl开发者_开发技巧e rusty now. Question is, I want to be able to post data to a website, it can be anything as long as it can call the url (without being in a browser).
a url like
http://website.com/login.php?username=USERNAME&password=PASS&rememberme=1
WebClient class is the easy way to go. Code sample from http://www.xtremevbtalk.com/showthread.php?t=158765
Dim oWeb As New System.Net.WebClient()
oWeb.Headers.Add("Content-Type", "application/x-www-form-urlencoded")
Dim bytArguments As Byte() = System.Text.Encoding.ASCII.GetBytes("q=InTheory")
Dim bytRetData As Byte() = oWeb.UploadData("http://www.google.com/search", "POST", bytArguments )
debug.Write(System.Text.Encoding.ASCII.GetString(bytRetData))
精彩评论