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.
In reply to Re: html parsing
by shmem
in thread html parsing
by bigup401
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |