NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Can you help with this perl error?

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 08-25-2006, 10:04 AM THREAD STARTER               #1 (permalink)
Senior Member
 
Barrucadu's Avatar
Join Date: Aug 2005
Location: East Yorkshire, England
Posts: 2,689
Barrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to behold
 




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 by Mikor; 08-25-2006 at 10:43 AM.
Barrucadu is offline  
Old 08-25-2006, 10:53 AM   #2 (permalink)
NamePros Regular
 
sjaguar13's Avatar
Join Date: Nov 2005
Posts: 383
sjaguar13 has a spectacular aura aboutsjaguar13 has a spectacular aura about
 



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.
sjaguar13 is offline  
Old 08-25-2006, 11:41 AM THREAD STARTER               #3 (permalink)
Senior Member
 
Barrucadu's Avatar
Join Date: Aug 2005
Location: East Yorkshire, England
Posts: 2,689
Barrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to behold
 




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 by Mikor; 08-25-2006 at 11:58 AM.
Barrucadu is offline  
Old 08-28-2006, 06:26 PM   #4 (permalink)
NamePros Member
Join Date: May 2006
Posts: 50
mp123456 will become famous soon enoughmp123456 will become famous soon enough
 



well if you're looking for a regex:
my ($title) = ($content=~m@<title>\s*(.*?)\s*</title>@is);
mp123456 is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 04:51 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger