Hi,

I'm currently working on a script doing login function with a website.

The login action requires a hash-like parameters as

login[account] = "foobar / example.com"
login[passwd] = "whatever"

setting params in net/http like

require "net/http"
require "net/https"

https = Net::HTTP.new("passport.115.com", 443)
https.use_ssl = true
req = Net::HTTP::Post.new("/?ac=login")
req["login[account]"] = "foobar / example.com"
req["login[passwd]"] = "whatever"
res = https.request(req)

p res.to_hash

won't work, looks like the params weren't passed properly.

and with

req.set_form_data({"login" => {"account" => "foobar / example.com", "login"
=> "passwd"}})

has no luck either.



but with

req.set_form_data({"login[account]" => "foobar / example.com",
"login[passwd]" => "whatever"})

doing the job.

Any ideas?

Thanks

-- 
Silence is golden.

twitter: @areverie
wikipedia: AleiPhoenix
blog: weblog.areverie.org
wiki: wiki.areverie.org