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

Alright perlmongers, I have the following code, and for some reason it's returning a page saying my browser does not support frames, even though I have used the frames compatible version of LWP. Please can someone help this is doing my head in!
use strict; use LWP::UserAgent::FramesReady; use URI::URL; use HTTP::Cookies; # put your perlmonks username and password here my $pm_user=''; my $pm_password=''; #instantiate new user agent my $WWWAgent = new LWP::UserAgent::FramesReady(); # attach cookiejar to user agent my $co=new HTTP::Cookies(file=>'./cookies.dat',autosave=>1); $WWWAgent->cookie_jar($co); # build request to simulate login my $url=new URI::URL 'http://mail.mybudweiser.com/chekin.php'; $url->query_form( bounceto => '', nobounce => '', email => 'someusername@budweiser.com', password => 'somepassword'); my $WWWRequest = new HTTP::Request 'GET', $url->as_string() ; # submit request my $WWWResult = $WWWAgent->request($WWWRequest, './out.html'); die "Error logging in $WWWResult->code $WWWResult->message" if(!$WWWResult->is_success);

Replies are listed 'Best First'.
Re: LWP::FramesReady question
by antirice (Priest) on Aug 19, 2003 at 23:58 UTC

    This truly is a case where reading the documentation would have made this problem's solution very apparent. Just use $WWWAgent->request($WWWRequest) as it will then return a HTTP::Response::Tree object instead of a HTTP::Response object. The tree will contain all the pages you want. Just iterate over them as you need. This is left as an excercise for the reader. Furthermore if you know how many frames deep you need, LWP::UserAgent::FramesReady adds a method called max_depth. As a parameter, it takes the number of frames in depth it should fetch. It defaults to 3.

    Hope this helps.

    antirice    
    The first rule of Perl club is - use Perl
    The
    ith rule of Perl club is - follow rule i - 1 for i > 1

Re: LWP::FramesReady question
by Anonymous Monk on Aug 20, 2003 at 01:42 UTC
    Try and fake a browser request / HTTP-agent from IE/Mozilla. Perhaps their PHP scripts are detecting your LWP an throwing you the wrong page ...