Skip to content

Instantly share code, notes, and snippets.

@jeffrydegrande
Created March 12, 2009 01:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffrydegrande/77858 to your computer and use it in GitHub Desktop.
Save jeffrydegrande/77858 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# small script to check on your protocolo
require 'rubygems'
require 'mechanize'
require 'hpricot'
url = 'https://servicos.dpf.gov.br/SincreWeb/protocolo'
agent = WWW::Mechanize.new
page = agent.get(url)
form = page.forms.first
form.nrprot = ARGV[0]
page = agent.submit(form)
doc = Hpricot(page.body)
puts (doc/'font[@class=simboloObrigatorio]').inner_html.gsub(/<\/?[^>]*>|\n|\t/, "")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment