Hi there,
I am trying to use ruby to login to a web site and then
browse some of the other web pages.
As shown below is my codes.
I can pass the login phase,
but I can not access other pages after login.
I only got the login page instead.
Could someone help?
Regards,
Kevin
#!/usr/bin/ruby
require ‘uri’
require ‘net/http’
require ‘net/https’
url = “http://www.mycompany.com/signin.php”
uri = URI(url)
Net::HTTP.start(uri.host, uri.port) do |http|
request = Net::HTTP::Post.new(uri)
request.set_form_data(‘email’ => ‘[email protected]’, ‘pass’ =>
‘xxxxxxxxx’)
response = http.request request
url = “http://www.snsbay.com/control/order.php”
uri = URI(url)
request = Net::HTTP::Get.new uri
response = http.request request
print response.body
end