CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate: Re: [limner] need help: program retrieving html: Edit Log



Zhris
Enthusiast

Feb 18, 2014, 2:58 PM


Views: 7864
Re: [limner] need help: program retrieving html

UPDATE: scrap what I mentioned below, it doesn't return the correct content. Please see later posts.

Hi,

When I execute this simplified version, it appears to return the correct content?

plain text: http://test.massweb.co.uk/bookingsrequest.pl
html: http://test.massweb.co.uk/bookingsrequest.pl?html=1


Code
#!/usr/bin/perl 
use strict;
use warnings;
use LWP::UserAgent;

my $url = 'http://www.booking.com/hotel/it/sleeping-beauty.it.html?checkin=2014-03-02&checkout=2014-03-03';

my $ua = LWP::UserAgent->new;

my $req = HTTP::Request->new( GET => $url );

my $res = $ua->request( $req );

if ( $res->is_success )
{
print $res->decoded_content;
}
else
{
print "Error: " . $res->status_line . "\n";
}


Chris


(This post was edited by Zhris on Feb 18, 2014, 3:45 PM)


Edit Log:
Post edited by Zhris (Enthusiast) on Feb 18, 2014, 3:00 PM
Post edited by Zhris (Enthusiast) on Feb 18, 2014, 3:01 PM
Post edited by Zhris (Enthusiast) on Feb 18, 2014, 3:03 PM
Post edited by Zhris (Enthusiast) on Feb 18, 2014, 3:11 PM
Post edited by Zhris (Enthusiast) on Feb 18, 2014, 3:44 PM
Post edited by Zhris (Enthusiast) on Feb 18, 2014, 3:44 PM
Post edited by Zhris (Enthusiast) on Feb 18, 2014, 3:45 PM
Post edited by Zhris (Enthusiast) on Feb 18, 2014, 3:45 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives