source code taken from cacert-20100505.tar.bz2
[cacert.git] / cacertupload.pl
1 #!/usr/bin/perl
2
3 #LibreSSL - CAcert web application
4 #Copyright (C) 2004-2008 CAcert Inc.
5 #
6 #This program is free software; you can redistribute it and/or modify
7 #it under the terms of the GNU General Public License as published by
8 #the Free Software Foundation; version 2 of the License.
9 #
10 #This program is distributed in the hope that it will be useful,
11 #but WITHOUT ANY WARRANTY; without even the implied warranty of
12 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 #GNU General Public License for more details.
14 #
15 #You should have received a copy of the GNU General Public License
16 #along with this program; if not, write to the Free Software
17 #Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
19 use LWP::UserAgent;
20 $ua = LWP::UserAgent->new(agent => 'Translingo Client 1.0');
21 use HTTP::Request::Common qw(POST);
22
23 $ua->cookie_jar({});
24 $ua->timeout(10000);
25
26 my $req = POST 'http://translingo.cacert.org/login.php',
27 [
28 ];
29 # ggf. Referer faken
30 $req->referer('http://translingo.cacert.org/');
31 $ua->request($req)->as_string;
32
33 # 1.Test - Umgebung
34 my $req = POST 'http://translingo.cacert.org/login.php',
35 [
36 username => 'support@cacert.org',
37 password => 'ilccSSAMNIemU',
38 submit => 'Login',
39 ];
40 # ggf. Referer faken
41 $req->referer('http://translingo.cacert.org/');
42 $ua->request($req)->as_string;
43
44 # 2.Test - FileUpload
45 my $req = POST 'http://translingo.cacert.org/upload.php',
46 Content_Type => 'form-data',
47 Content => [
48 project => '1',
49 fileformat => '1',
50 pofile => ["messages.po" => "messages.po", 'Content_Type' => "application/x-gettext"],
51 ];
52 print $ua->request($req)->as_string;
53