Thread von LWP nach WWW::Mechanize (9 answers)
Opened by Gast at 2010-02-24 09:17

Gast Gast
 2010-02-24 09:17
#133564 #133564
Hallo! Kann mir das jemand aus dem Stegreif nach WWW::Mechanize übersetzten?

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env perl
use warnings;
use strict;
use LWP;
use HTTP::Cookies;

my $ua = LWP::UserAgent->new( 
    timeout => 20,
    keep_alive => 1,
    agent => 'Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.0) Gecko/20100115 SUSE/3.6.0-1.2 Firefox/3.6',
    cookie_jar => new HTTP::Cookies,
    requests_redirectable => [ 'HEAD', 'GET', 'POST' ]
);

my $start_url = 'http://www.start_url.gt';
my $loginData = "userName=username&password=password&...&...";
my $loginUrl = "https://www.hallo_welt.gt/login.do";

my $req = HTTP::Request->new( POST => $loginUrl );
$req->content( $loginData );
$req->header( 'Content-type' => 'application/x-www-form-urlencoded' );
$req->header( 'Referer' => $start_url );
my $reply = $ua->

View full thread von LWP nach WWW::Mechanize