Thread Login klappt nicht mit LWP, Cookies, 302 redirect (8 answers)
Opened by Franz at 2007-05-31 11:22

Franz
 2007-05-31 11:22
#29025 #29025
User since
2006-07-12
31 Artikel
BenutzerIn
[default_avatar]
Hallo,
ich möchte per Script Seiten aus delicious speichern. Dazu logge ich mich ein per POST. Ist das erfolgreich so erfolgt ein redirect auf meine Benutzerseite.

Nach dem Redirect bin ich aber nichgt mehr eingeloggt, was ich am Ergebnis sehen kann.

Ich vermute es liegt am Cookie, da mache ich wohl etwas falsch. Ich kann leider nicht erkennen was da falsch läuft.

Ich hoffe mir kann jemand einen Tipp geben.


Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use warnings;
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Cookies;
use FileHandle();

$fh = new FileHandle("content.htm","w");

$loginUrl="https://secure.del.icio.us/login";
$login="test";
$password="123";

my $ua = LWP::UserAgent->new();
my $cookie_jar = HTTP::Cookies->new;
$ua->cookie_jar($cookie_jar);
push @{ $ua->requests_redirectable }, 'POST';

my $response = $ua->post($loginUrl,['user_name'=>$login,'password'=>$password,'login'=>"log in"],'Referer' =>'https://secure.del.icio.us/login');
$cookie_jar->extract_cookies($response);

print ($fh $response->content());


Das ganze läuft auf nem Windows, openssl habe ich installiert - die Anmeldung klappt ja eigentlich auch, laut header.

View full thread Login klappt nicht mit LWP, Cookies, 302 redirect