Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Download PDF's

by Godsrock37 (Sexton)
on Jun 19, 2008 at 14:29 UTC ( #692927=perlquestion: print w/replies, xml ) Need Help??

Godsrock37 has asked for the wisdom of the Perl Monks concerning the following question:

How would I go about downloading a pdf from the internet?

first off i found the pdf modules and briefly glanced over how to use it, but i have no idea how i would open a url-based pdf to then save locally...

i looked at web fetch but that seemed focused on downloading news and just plain old websites...

any thoughts?

Replies are listed 'Best First'.
Re: Download PDF's
by moritz (Cardinal) on Jun 19, 2008 at 14:35 UTC

      Really?! That's hot. So I could do:

      my $response = $robot->get($url, $url); if ($response->is_success and $response->content_type eq 'application/ +pdf'){ print PDF $contents; }

      how would i get $contents? Some type of parsing?

      I guess that means i can do the same thing with pictures too?

        Even easier:

        use strict; use LWP::Simple qw/getstore/; my $url = "http://blahblah/file.pdf"; my $file = "/home/user/file.pdf"; getstore($url, $file);
Re: Download PDF's
by marto (Cardinal) on Jun 19, 2008 at 14:51 UTC
    A nice an easy way would be to use LWP, it provides lwp-download (along with other helpful scripts) which you can either just use as a script, or as a basis for your own script to achieve your goal.

    Hope this helps


      thanks marto... i checked it out... now i have a few options. i'll see whats easier and takes up the least processor time and go from there. thanks again

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://692927]
Approved by moritz
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (4)
As of 2022-12-06 20:38 GMT
Find Nodes?
    Voting Booth?

    No recent polls found