Skip to content

Instantly share code, notes, and snippets.

@luelher
Last active September 28, 2017 15:53
Show Gist options
  • Save luelher/2316697ed68f85856f24762e6c4c46ed to your computer and use it in GitHub Desktop.
Save luelher/2316697ed68f85856f24762e6c4c46ed to your computer and use it in GitHub Desktop.
Tratando de Ganarle a la Mediocridad del MPPRE, lo cual es una taréa difícil, son muy buenos siendo mediocres.
require 'net/http'
require 'openssl'
count = 0
while true do
uri = URI.parse('https://citaslegalizaciones.mppre.gob.ve/')
status = ""
begin
puts "Testing...."
http = Net::HTTP.new(uri.host, uri.port)
http.open_timeout = 15
http.read_timeout = 15
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
status = http.get(uri.request_uri).code
rescue Exception => e
puts "Nop! error: #{e}"
count = 0
ensure
if status == "200"
count += 1
if count == 4
puts "Yes!"
sms = URI('https://api.textveloper.com/sms/enviar/')
Net::HTTP.post_form(sms,
telefono: '04245558074',
mensaje: 'Revisa la Pagina de la postilla',
cuenta_token: 'abcde',
aplicacion_token: 'abcde')
Net::HTTP.post_form(sms,
telefono: '04245023093',
mensaje: 'Revisa la Pagina de la postilla',
cuenta_token: 'abcde',
aplicacion_token: 'abcde')
puts "SMS send"
break
end
else
puts "Nop! #{status}"
count = 0
end
end
puts "waiting 3 min"
sleep(120)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment