I have a script that parses www.imagefap.com. Well, ALMOST parses, anyway! It has a page that pops up asking my bot to say I'm 18 or over to view some of the pictures (all it asks is to follow a link that looks like
<a href="image.php?id=1117159255&check=6f4e9753bb326bc0a11f76f188160af +3">I am 18 years of age or older</a>
Calling it directly with LWP::UserAgent doesn't appear to be working, perhaps it's not storing it in my cookie jar this way.

My question is, because I am using proxies to load the pages I'm using LWP::UserAgent. However, to follow the links to say my bot is of age, I need to use WWW::Mechanize.

I'm not sure how to get the two to work together. Can anyone see, from my code below, how I can manage to get it to follow the link with WWW::Mechanize while keeping the cookies and all that I need inside UserAgent? Or can this ALL be done using WWW::Mechanize without directly calling UserAgent?

my $ua = LWP::UserAgent->new; $ua->proxy('http', "http://$ad:$pt"); # assume this is a working + IP with a port number $ua->timeout(5); my ($one, $two) = split(/::/, $shuffled[$urlcnt]); #one is the U +RL, two is a custom referer url $ua->default_header('Referer' => "$two"); # added my own referer my $response = $ua->get($one); # my attempt at scraping the page and manually GETting the ver +ification link $response->content =~ m/image\.php\?id=(\d+)\&check=([a-zA-Z0- +9]+)/; print "\t\t- http://imagefap.com/image.php?id=$1&check=$2 link +\n"; $ua->get("http://imagefap.com/image.php?id=$1&check=$2"); $ua->mirror("http://imagefap.com/image.php?id=$1&check=$2", "f +ap.html") or die "Error: $!";
I have been trying to get this ImageFap bot to work for quite some time now and it's fun trying new tricks to get it to work.. but for now, I am stumped.

In reply to mixing www::mech and lwp::UA by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.