in reply to html parsing
my $req = HTTP::Request->new(GET => 'https://www.google.com'); $req->content_type('application/json'); my $res = $ua->request($req);
Please edit your post including the initialization of $ua:
use LWP; my $ua = LWP::UserAgent->new; my $req = HTTP::Request->new(GET => 'https://www.google.com'); $req->content_type('application/json'); my $res = $ua->request($req);
Thank you. You could get the contents of the <title> tag just using a regular expression
my $title; $res->content =~ m|<title>(.+?)</title>|i and $title = $1;
but see e.g. Re: Why this simple regex freeze my computer? for caveats.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: html parsing
by Anonymous Monk on Mar 22, 2017 at 15:25 UTC | |
by shmem (Chancellor) on Mar 22, 2017 at 15:40 UTC | |
by Anonymous Monk on Mar 22, 2017 at 15:51 UTC | |
|
Re^2: html parsing
by bigup401 (Pilgrim) on Mar 22, 2017 at 19:53 UTC |