Ever wanted to view the source code of another page or site using coldfusion? Well, you won't believe how simple it can be.

We will be using 1 tag and 1 function to accomplish this.

<!--- Set the URL of the page's source you want to view --->
<cfhttp method="get" url="http://www.google.com"></cfhttp>

<!--- Then we display the view source code by doing this: --->

That's all there is! That will display the source code of any URL on the web, this is how it all looks together:

    <cfhttp method="get" url="http://www.google.com"></cfhttp>

Have Fun!

About This Tutorial
Author: Matt Wegrzyn
Skill Level: Beginner 
Platforms Tested: CFMX
Total Views: 97,170
Submission Date: January 28, 2005
Last Update Date: June 05, 2009
All Tutorials By This Autor: 2
Discuss This Tutorial
  • There is no way to actually fullly encode an html page as far as I know. Also, the code in this tutorial can be made clearer, by using htmlcodeformat, instead of htmleditformat. When I wrote this tutorial, I didn't have as much cf knowledge. You may wish to display the http headers using cfhttp.header code as well: #htmlcodeformat(cfhttp.header)#


  • Sir, Great One, but have any Other method to encode page so nobody can view it


Sponsored By...
Mobile App Development (IOS, Android, Cordova, Phonegap, Objective-C, Java) - Austin, Texas Mobile Apps - Touch512, LLC.