/ Published in: Perl
Suitable for backup scripts.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#!/usr/bin/perl use strict; use LWP::UserAgent; my $silent = 0; # set to 1 for no output on stdout my $logindata = { 'username' => 'fill in your username', 'password' => 'fill in your password', }; my $loginurl = 'http://snipplr.com/login/'; my $backupurl = 'http://snipplr.com/zipbackup.php'; my $backupdir = '.'; my $ua = LWP::UserAgent->new; $ua->cookie_jar({ file => "cookies.txt" }); my $devnull = $ua->get('http://snipplr.com/'); #get cookie my $loginresponse = $ua->post($loginurl, $logindata); my $backupfile = $ua->get($backupurl); binmode KI;