开发者

http post with vb 9.0 (2008)

开发者 https://www.devze.com 2022-12-22 03:46 出处:网络
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

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))
0

精彩评论

暂无评论...
验证码 换一张
取 消