http://ruby-doc.org/stdlib-1.8.7/libdoc/net/http/rdoc/Net/HTTP.html
After reading the doc very carefully, I m writing the following code snippet for the autologin feature of my program:
url = URI.parse( http://localhost/login.aspx )
req = Net::HTTP::Post.new(url.path)
req.basic_auth username
指标网页仅询问正确的用户名称,不需要密码才能登录,如果我离开,用户名称和密码就要求两个参数,即用户名称和密码,那么我就试图把这个错误写成“req.basic_authusername,但我仍然无法登录。
谁能给我一个 h?
more info: I also tried req.basic_auth username , , it didn t seem to be working, I know this because there s another line of line follow right after this one, which is basically doing auto form submission. x = Net::HTTP.post_form(URI.parse("http://localhost/NewTask.aspx"), params) puts x.body
And the puts result came back with the redirect to login page body.