NameSilo

Can you help with this perl error?

Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
SpaceshipSpaceship
Watch

Barrucadu

Established Member
Impact
64
Perl Question

edit: Fixed original error, now I need help with something else

-----

How can I get the title of a page with LWP?
 
Last edited:
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Unstoppable Domains โ€” AI StorefrontUnstoppable Domains โ€” AI Storefront
You can use the TokeParser:

This assumes the content is returned to $content
Code:
$parser = HTML::TokeParser->new(\$content);
$parser->get_tag("title");
$title = $parser->get_token;
print $title->[1], "\n" if $title;

Or you could grep $content to find what's between the title tags.
 
0
•••
I've tried grep - but there is a problem:

Code:
@title = grep("<title>[a-z]</title>",$content);
push(@filetitles,@title);

But that always returns "HTTP::Request=HASH(0x1a8dab0) "

edit: fixed, used the wrong method for getting the content
 
Last edited:
0
•••
well if you're looking for a regex:
my ($title) = ($content=~m@<title>\s*(.*?)\s*</title>@is);
 
0
•••
Appraise.net
Escrow.com
Spaceship
Domain Recover
CryptoExchange.com
Catchy
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back