Function to get Page Title from a URL
I wrote a simple function today that grabs a url, and parses out the title of the page from the url:
<cffunction name="getPageTitle" returntype="string" output="false"> <cfargument name="pageurl" type="string" required="true"> <cfhttp method="get" redirect="true" url="#arguments.pageurl#" throwonerror="true"></cfhttp> <cfreturn ReReplace(cfhttp.fileContent, ".*<title>([^<>]*)</title>.*", "\1")> </cffunction> <cfoutput>#getPageTitle("http://www.macromedia.com/")#</cfoutput>
- Auto-Linking Comments - June 24, 2005
- Regex to Replace Multiple Blank Lines with One - May 19, 2005
- REFind and ReReplace support \r \n and \t - March 28, 2005
- Regular Expressions with ColdFusion - a Howto Guide - December 19, 2003
nice. You ought to submit it to cflib.org
Oops, a bit too quick with the old post button! That should have said: Cheers Ryan, How about using a ReReplaceNoCase it allow for HTML like: <TITLE>My Site</TITLE>? cheers David
Hi there... Copied and pasted this code block. Have updated it to now return a complete anchor with href and title attributes. Works like a charm. Very inventive thinking. Will definitely come in handy at some point. Cheers
hi, will this work using php? =)
Thanks for sharing this. I wanted to do the same thing today, but I'm not so great with the regular expressions.
Nice active blog you have. You have some great reading here.
I really enjoy reading your articles. Keep up the great work. TBoardenson
Domain for sale quality results found here
are you looking for check advance in florida check this site. check advance in florida can be found here to help you get through to payday.
Not secret that that that we search for, whereas you will not always find on the first page of search engine. But in other, although it rarely or in no way you use, this in sight. Therefore you will focus attention on http://www.iknowall.com. It searches for simultaneously in three largest bases of peace and issues results at will - on one page or on the different. Parsit'. is probable, also possible simultaneously all. http://www.iknowall.com
- Docker Container exited with code 137
- Why is my cron.daily script not running?
- Announcing FuseGuard Version 3
- CFSummit 2017
- Java Unlimited Strength Crypto Policy for Java 9 or 1.8.0_151
- Java 9 Security Enhancements
- Upcoming CFML Conferences in April 2017
- CFSummit 2016 Slides