Created
February 25, 2011 18:02
-
-
Save norman/844208 to your computer and use it in GitHub Desktop.
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" | |
require "uri" | |
def get_cpa(calle, altura) | |
url = "http://www3.correoargentino.com.ar/scriptsN/cpa/cpa_calle.idc" | |
res = Net::HTTP.post_form(URI.parse(url), { | |
:codloca => "5001", | |
:pnc => calle, | |
:alt => altura | |
}) | |
regexp = /<big><font face="Arial" color="#002B6D"><b>([A-Z0-9]*)<br><\/b><\/font><\/big>/ | |
return res.body.match(regexp)[1] | |
end | |
p get_cpa("Manuel Ugarte", 2158) |
Tanto más rápido que usando el sitio, gracias Norman! :-)
Al final lo actualizaron y la interfaz web vuelve a ser fácil. Me di cuenta porque el código dejó de andar, bienvenida la renovación!
Excelente - en un mundo ideal no existirían estos gists. :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sólo para buscar desde la terminal: https://gist.github.com/869662