Skip to content

Instantly share code, notes, and snippets.

@alexyoung
Created March 25, 2009 09:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexyoung/85395 to your computer and use it in GitHub Desktop.
Save alexyoung/85395 to your computer and use it in GitHub Desktop.
require 'net/http'
require 'uri'
data = 'email=test@example.com&password=your_password'
url = URI.parse('http://helipadapp.com/authenticate')
headers = {
'Content-Type'=> 'application/x-www-form-urlencoded'
}
http = Net::HTTP.new(url.host)
response, data = http.post(url.path, data, headers)
puts '*** HTTP Response ***'
response.each { |key, value| puts "#{key}: #{value}"}
puts ''
if response['location'].match 'login'
puts "STATUS: Login unsuccessful"
else
puts "STATUS: Logged in"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment