Created
July 14, 2012 07:10
-
-
Save waj/3109800 to your computer and use it in GitHub Desktop.
Automatic login at Landscape Hotel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
loop do | |
response = Net::HTTP.get_response URI.parse('http://www.google.com/') rescue nil | |
if response && response['Location'].start_with?('http://192.168.2.1:8000') | |
puts "#{Time.now} - Logging in..." | |
Net::HTTP.post_form URI.parse('http://192.168.2.1:8000'), { auth_user: '001', auth_pass: '001', redirurl: 'http://www.google.com/', accept: 'Continue' } | |
end | |
sleep 60 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment