[[ruby_test1.rb]]
@DIV
print "Content-Type: text/html; charset=utf-8\n\n"
require "cgi"
cgi = CGI.new(:accept_charset => 'utf-8')
require 'mechanize'
agent = Mechanize.new
agent.verify_mode = OpenSSL::SSL::VERIFY_NONE
agent.follow_meta_refresh = true
agent.user_agent = 'Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko'
page = agent.get("https://twitter.com/")
form = page.forms[1]
form["session[username_or_email]"] = cgi['user']
form["session[password]"] = cgi['pass']
page = form.submit
page = agent.get("https://twitter.com/")
print page.body
@END
@DIV
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<form action="ruby_test1.rb" method="post">
<input type="text" name="user">
<input type="password" name="pass">
<input type="submit" name="send">
</form>
@END |