Last active
July 30, 2017 23:31
-
-
Save roneygomes/a0f42a71ed34fd9d6251466c32c0710e to your computer and use it in GitHub Desktop.
Baixar Certidão Negativa de Débito
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
#!/bin/sh | |
# Como usar: ./baixar-certidao.sh <seu-cpf-aqui> | |
export LC_ALL=C | |
URL_BASE=http://www.receita.fazenda.gov.br/Aplicacoes/ATSPO/Certidao/CNDConjuntaSegVia | |
CERTIDAO=ResultadoSegVia.asp\?Origem\=1\&Tipo\=2\&NI\=${1} | |
CERTIDAO_N_ENCONTRADA=SegundaViaCNDConjuntaMsg.asp\?Tipo\=2\&NI\=${1} | |
curl $URL_BASE/$CERTIDAO | sed 's/testa_cookie()/true/g' > ./certidao.html | |
if [[ `cat ./certidao.html` == *"Object moved"* ]]; then | |
curl $URL_BASE/$CERTIDAO_N_ENCONTRADA | sed 's/testa_cookie()/true/g' > ./certidao.html | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment