Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

How to tell if POST works?!

by BinBerliner (Novice)
on Mar 04, 2001 at 01:27 UTC ( #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
Node Status?
node history
Node Type: note [id://62051]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2019-10-18 22:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?