http://www.perlmonks.org?node_id=61848

BinBerliner has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to write a client to grab data from www.friendscout.de . I have created a test account called "JohnSmith" with password "test". The first get_url() below works as expected but the second one always "fails". What do I mean with fail? The HTML returned includes the text "Da Sie zu lange inaktiv waren, wurde Ihre Sitzung beendet. Bitte laden Sie erneut die Startseite." This means, "Because you were inactive for too long then your sitting has been ended. Please load the start side again". This is my first attempt to write a robot... Any ideas what I'm doing wrong?
use strict; use LWP::UserAgent; my $hdrs = new HTTP::Headers(Accept => 'text/plain', User-Agent => 'IE +/5.0'); my $ua = new LWP::UserAgent; get_url('http://www.friendscout.de/cgi-bin/pu_help.fcgi?id=1-d24-fL6sA +siUXoQo7uGcUZ6T6Hjs&page=loginp&nickname=JohnSmith&password=test&x=0& +y=0'); get_url('http://www.friendscout.de/cgi-bin/pu_login1.fcgi?password=tes +t&nickname=JohnSmith&?id=1-d24-fL6sAsiUXoQo7uGcUZ6T6Hjs&x=13&y=9'); sub get_url() { my $url2get = shift @_; my $url = new URI::URL($url2get); my $req = new HTTP::Request('GET', $url, $hdrs); my $resp = $ua->request($req); if ($resp->is_success) { printf "Good %s",$resp->content;} else { printf "Bad %s",$resp->message;} }