I wrote a simple CFML / ColdFusion 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("https://www.petefreitag.com/")#</cfoutput>
Comments
nice. You ought to submit it to cflib.org
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
I really enjoy reading your articles. Keep up the great work. TBoardenson