Skip to content

Instantly share code, notes, and snippets.

@carlows
Created January 16, 2016 20:23
Show Gist options
  • Save carlows/24d7ea5c32978a508913 to your computer and use it in GitHub Desktop.
Save carlows/24d7ea5c32978a508913 to your computer and use it in GitHub Desktop.
require 'rest-client'
RestClient.post('http://www.unitec.edu.ve/servlet/unicodeServlets.Login', {:TID => "usuario", :TClave => "contraseña"}){ |response, request, result, &block|
if [301, 302, 307].include? response.code
session_cookie = "JSESSIONID=#{response.cookies["JSESSIONID"]}"
puts session_cookie
response = RestClient.get 'http://www.unitec.edu.ve/indexestudiante.jsp', {:Cookie => session_cookie}
puts response
else
response.return!(request, result, &block)
end
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment