in reply to LWP::UserAgent can't login to phpbb forum

The usual step is to compare what FireFox gives you against what WWW::Mechanize or LWP::UserAgent give you. For example by printing out the HTTP request you create (->as_string method of HTTP::Request).

Of course, with WWW::Mechanize, there would likely be less need for extracting the sid parameter from the HTML through munging.

My personal guess is that your @sids are not what you expect.

Replies are listed 'Best First'.
Re^2: LWP::UserAgent can't login to phpbb forum
by jettero (Monsignor) on Apr 03, 2008 at 11:03 UTC

    compare what FireFox gives you against what WWW::Mechanize or LWP::UserAgent give you.

    I usually use HTTP::Proxy to do that comparison. Then I not only see what firefox sent, but what the Data::Dumper dump of the LWP object looks like.

    The output in the query log shouldn't be used directly, but the sources it logs will prove the query can be done with LWP. The next step is just to figure out what the object you built by hand is missing.

    -Paul

Re^2: LWP::UserAgent can't login to phpbb forum
by mnem0 (Initiate) on Apr 03, 2008 at 15:31 UTC
    Thank you, you're kind. i read HTTP::Request, LWP::UserAgent, lwp cookbook, tried all, i only have the http headers of the response printed. not the header of the post. i tried this
    use HTTP::Request::Common qw(POST); use LWP::UserAgent; $ua = LWP::UserAgent->new; my $req = POST 'http://www.host.com/login.php?sid='.@sids[0], [ username => 'myUserName', password => 'myPasswd', lo +gin => 'Connexion' ]; print $ua->request($req)->as_string;
    i also tried this
    open WRITER3 ,"> header.txt" my $res = $ua->post($url_base.'?sid='.$sids[0],[username => 'myUsernam +e', password=>'myPasswd',login=>'Connexion']); print WRITER3 $res->as_string;
    how can i get the headers of my posts please ?

      You only see the headers of the response because you only print the headers of the response. Maybe you should try printing the headers of the request instead? I think I recommended that to you already.

      Other than that, you might just want to inspect the network traffic by other means, like using WireShark, a network sniffer, or by using LWP::Debug.