Thread get source code with LWP::UserAgent (9 answers)
Opened by Gizmo at 2013-12-11 19:39

Gast Gizmo
 2013-12-11 19:39
#172552 #172552
is it possible to get the source code of the page i am calling with LWP - UserAgent & save it in a textfile?
if i try this
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
#!/usr/bin/perl
use strict;
use LWP::UserAgent;

my $ua = LWP::UserAgent->new();
my $url = "http://www.google.com/";
my $rsp = $ua->get($url);

open (DATEI, ">code.html");
print DATEI "$rsp";
close (DATEI);

it only gives me a hash (HTTP - Response) is there any other way?
thx in advance!
Last edited: 2013-12-11 19:41:36 +0100 (CET)

View full thread get source code with LWP::UserAgent