I have a list of URLs, and they are all like this: http://www.contratos.gov.co/consultas/detalleProceso.do?numConstancia=10-10-85225 ; inside those pages there are .pdf files being referenced. I need to download those files with wget or curl.

I tried to do this:

wget -r http://www.contratos.gov.co/consultas/detalleProceso.do?numConstancia=10-10-85225 -l2 --accept .pdf


wget -r -l1 --no-parent -A ".pdf" http://www.contratos.gov.co/consultas/detalleProceso.do?numConstancia=10-10-85225  

but I get a protocol error:

Resolving www.contratos.gov.co (www.contratos.gov.co)... Connecting to www.contratos.gov.co (www.contratos.gov.co)||:80... connected. HTTP request sent, awaiting response... 200 OK Length: unspecified [text/html] www.contratos.gov.co/consultas/detalleProceso.do?numConstancia=10-10-85225: Protocol error

Cannot write to `www.contratos.gov.co/consultas/detalleProceso.do?numConstancia=10-10-85225' (Protocol error)

What flags can I use to command wget to parse a URL and then download pdf files linked inside of the initial page?

1 Answer 1


Wget and Curl only parse links within the anchor tags on a HTML Document.
The page you are referring to, uses a POST Method with the link to the document to download it.

You will have to download the file and parse it manually for all links. This is something that wget will not do for you.

EDIT: However I do not know why you are receiving a protocol error. Would you mind to run the same commands with a --debug option and paste the output somewhere where we can see it?

  • Hi darnir, the protocol error goes away when specifying the output file with -O. You are right, I have to download first the files, then parse them. Thanks for have a look at it!
    – Alex. S.
    Mar 27, 2013 at 3:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .