FAQ 9.25 How do I fetch/put an FTP file?

Discussion in 'Perl Misc' started by PerlFAQ Server, Feb 19, 2011.

  1. This is an excerpt from the latest version perlfaq9.pod, which
    comes with the standard Perl distribution. These postings aim to
    reduce the number of repeated questions as well as allow the community
    to review and update the answers. The latest version of the complete
    perlfaq is at http://faq.perl.org .

    --------------------------------------------------------------------

    9.25: How do I fetch/put an FTP file?

    (contributed by brian d foy)

    The "LWP" family of modules (available on CPAN as the libwww-perl
    distribution) can work with FTP just like it can with many other
    protocols. "LWP::Simple" makes it quite easy to fetch a file:

    use LWP::Simple;

    my $data = get( 'ftp://some.ftp.site/some/file.txt' );

    If you want more direct or low-level control of the FTP process, you can
    use the "Net::FTP" module (in the Standard Library since Perl 5.8). It's
    documentation has examples showing you just how to do that.



    --------------------------------------------------------------------

    The perlfaq-workers, a group of volunteers, maintain the perlfaq. They
    are not necessarily experts in every domain where Perl might show up,
    so please include as much information as possible and relevant in any
    corrections. The perlfaq-workers also don't have access to every
    operating system or platform, so please include relevant details for
    corrections to examples that do not work on particular platforms.
    Working code is greatly appreciated.

    If you'd like to help maintain the perlfaq, see the details in
    perlfaq.pod.
    PerlFAQ Server, Feb 19, 2011
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Daniel  Santa Cruz

    Put a file on an ftp server over ssl

    Daniel Santa Cruz, May 10, 2005, in forum: Python
    Replies:
    4
    Views:
    253
    Rick Holbert
    May 11, 2005
  2. D. Buck
    Replies:
    2
    Views:
    483
    D. Buck
    Jun 29, 2004
  3. Asaf Sinai
    Replies:
    1
    Views:
    249
    Chris Davies
    Jul 4, 2006
  4. PerlFAQ Server

    FAQ 9.8 How do I fetch an HTML file?

    PerlFAQ Server, Feb 25, 2011, in forum: Perl Misc
    Replies:
    0
    Views:
    109
    PerlFAQ Server
    Feb 25, 2011
  5. PerlFAQ Server
    Replies:
    0
    Views:
    125
    PerlFAQ Server
    Apr 5, 2011
Loading...

Share This Page