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.
Summary of Contents for COLDFUSION 4.5-DEVELOPING WEB
Page 1: ...Allaire Corporation Developing Web Applications with ColdFusion ColdFusion 4 5...
Page 14: ...xiv Developing Web Applications with ColdFusion...
Page 26: ...xxvi Developing Web Applications with ColdFusion...
Page 34: ...8 Developing Web Applications with ColdFusion...
Page 70: ...44 Developing Web Applications with ColdFusion...
Page 84: ...58 Developing Web Applications with ColdFusion...
Page 114: ...88 Developing Web Applications with ColdFusion...
Page 148: ...122 Developing Web Applications with ColdFusion...
Page 174: ...148 Developing Web Applications with ColdFusion...
Page 208: ...182 Developing Web Applications with ColdFusion...
Page 244: ...218 Developing Web Applications with ColdFusion...
Page 274: ...248 Developing Web Applications with ColdFusion...
Page 288: ...262 Developing Web Applications with ColdFusion...
Page 300: ...274 Developing Web Applications with ColdFusion...
Page 350: ...324 Developing Web Applications with ColdFusion...
Page 362: ...336 Developing Web Applications with ColdFusion...