-
-
Save norman/844208 to your computer and use it in GitHub Desktop.
| 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) |
LOL, unfortunately true. At very least I'm glad they're using plain old HTML rather than Flash or some other nonsense.
That is really useful! :)
Maybe here in Brazil we could also use this kind of web services hehe :)
Haha, I would just be happy if Brazilian web forms stopped asking people in other countries for a valid CEP! I can't tell you how many times I've had to Google for the format to defeat crappy form validation.
hahaha yeah, that is true! :)
But i think that is some kind of global issue, i can't remember how many times i had to find myself a zip code as well hehe
Sólo para buscar desde la terminal: https://gist.github.com/869662
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. :)
Possibly the quickest way Argentine institutions will provide 'web services'