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;}
}
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|