Skip to content

Instantly share code, notes, and snippets.

@waj
Created July 14, 2012 07:10
Show Gist options
  • Save waj/3109800 to your computer and use it in GitHub Desktop.
Save waj/3109800 to your computer and use it in GitHub Desktop.
Automatic login at Landscape Hotel
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