Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

How to tell if POST works?!

by BinBerliner (Novice)
on Mar 04, 2001 at 01:27 UTC ( [id://62051]=note: print w/replies, xml ) Need Help??


in reply to How to submit name & password using LWP ?

The following snippet of code does the same thing no matter which "nickname" and "password" are entered. How can the client tell if they have been accepted or rejected?
use LWP::UserAgent; use HTTP::Request::Common; $ua = LWP::UserAgent->new; my ($response, $url) = clickon("", ''); ($response, $url) = clickon($response->content, 'content="\d+;url=([^" +]+)'); ($response, $url) = clickon($response->content, 'location.href="([^"]+ +)"'); ($response, $url) = clickon($response->content, 'frame name="login" sr +c="([^"]+)"'); $response = $ua->request(POST $url, [nickname => "JohnSmith", password + => "test"]); print $response->content; print $response->message; sub clickon { my $content = shift @_; my $filter = shift @_; if ($content =~ /$filter/m) { print "\n\n*********MATCH($1)*******\n\n"; my $url = "http://www.friendscout.de$1"; return ($ua->request(GET $url), $url); } else { die "redirect not found !"; } }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://62051]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-25 11:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found