Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

LWP::UserAgent::FramesReady;

by shockme (Chaplain)
on Dec 09, 2003 at 18:04 UTC ( #313467=perlquestion: print w/ replies, xml ) Need Help??
shockme has asked for the wisdom of the Perl Monks concerning the following question:

I think I'm missing something fairly basic. I'm trying to access a website which requires frames. Following is my script:
#!/usr/bin/perl use strict; use warnings; use URI::URL; use LWP::UserAgent::FramesReady; my $ua = new LWP::UserAgent; # neither of the following have any effect #$ua->agent('Mozilla/5.0'); #$ua->agent('Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET C +LR 1.1.4322)'); my $url = URI->new('http://www.takingbackthecountry.com'); my $http_request = new HTTP::Request('GET', $url); my $response = $ua->request($http_request); if ($response->is_success and $response->isa('HTTP::Response::Tree')) { print "ok\n"; } else { print $response->content; } exit;
This results in the following output:
<HTML> <HEAD> <meta name="DESCRIPTION" content=""> <TITLE></TITLE> </HEAD> <!-- Redirection Services Redirector2B-DAL 200-OK --> <FRAMESET ROWS="100%, *" frameborder="no" framespacing=0 border=0> <FRAME SRC="http://takinthecountryback.com" NAME="mainwindow" frameb +order="no" framespacing="0" marginheight="0" marginwidth="0"></FRAME> </FRAMESET> <NOFRAMES> <CENTER> <H2> Your browser does not support frames. We recommend upgrading your + browser. </H2> <br><br> Click <a href="http://takinthecountryback.com">here</a> to enter th +e site. </CENTER> </NOFRAMES> </HTML>

I've dug through several of the test scripts included with LWP::UserAgent::FramesReady, but I'm just not seeing what I'm missing.

If things get any worse, I'll have to ask you to stop helping me.

Comment on LWP::UserAgent::FramesReady;
Select or Download Code
Re: LWP::UserAgent::FramesReady;
by holo (Monk) on Dec 09, 2003 at 18:24 UTC

    First of all, you should use LWP::UserAgent::FramesReady not LWP::UserAgent to construct the $ua.

    my $ua = new LWP::UserAgent::FramesReady;

    The result is not an HTTP::Response instance, rather a more appropriate HTTP::Response::Tree object since more than one page is fetched (The main page, the frames, sub-frames, etc...). It's pretty straight forward to get all the responses out with @responses = $response_tree->children();.

      Wow. I guess the documentation is wrong:
      SYNOPSIS use LWP::UserAgent::FramesReady; $ua = new LWP::UserAgent; $response = $ua->request($http_request);

      But you are correct. It's working great now. Thanks!

      If things get any worse, I'll have to ask you to stop helping me.

        Please consider submitting a documentation patch, or at least letting Alan E Derhaag know about this.

        ciao ciao!

        -nuffin
        zz zZ Z Z #!perl

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://313467]
Approved by barbie
Front-paged by tye
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2014-08-21 03:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (127 votes), past polls