User Guide
Chapter 15: Interacting with Remote Servers 233
Code Review
To get a Web page and save it in a file:
1. Open a new file in Studio.
2. Modify the file so that it appears as follows:
<CFHTTP
METHOD = "get"
URL="http://www.allaire.com/index.cfm"
PATH="c:\mine"
FILE="allaireindex.cfm">
3. Change the path from c:\mine to point to a path on your hard drive.
4. Save the file as
savewebpage.cfm and view it in your browser.
Code Review
To get a binary file and save it:
1. Open a new file in Studio.
2. Modify the file so that it appears as follows:
Code Description
<CFHTTP METHOD="Get"
URL="http://www.allaire.com/index.cfm"
RESOLVEURL="Yes">
Get the page specified in the
URL and make the links
absolute instead of relative..
<CFOUTPUT>
#CFHTTP.FileContent# <BR>
</CFOUTPUT>
Display the page, which is
stored in the variable
CFHTTP.FileContent, in the
browser.
Code Description
<CFHTTP
METHOD = "get"
URL="http://www.allaire.com/index.cfm"
PATH="c:\mine"
FILE="allaireindex.cfm">
Get the page specified in the
URL and save it in the file
specified in PATH and FILE.
Note that when the PATH and
FILE attributes are used, the
RESOLVEURL attribute is
ignored, even if present.