in reply to How to copy a PDF file

The module WWW::Mechanize was written for exactly this kind of task. Take a look at it, read the examples, and try to change them to fit to your situation.