Function to get Page Title from a URL

March 23, 2005

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")>


Like this? Follow me ↯

You might also like:

14 people found this page useful, what do you think?


nice. You ought to submit it to
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
Nice active blog you have. You have some great reading here.
Great blog.
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 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.

Foundeo Inc.