User Guide

Table Of Contents
991
CHAPTER 40
Interacting with Remote Servers
This chapter describes how Macromedia ColdFusion MX wraps the complexity of Hypertext
Transfer Protocol (HTTP) and File Transfer Protocol (FTP) communications in a simplified tag
syntax that lets you extend your sites offerings across the web.
Contents
About interacting with remote servers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 991
Using cfhttp to interact with the web. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 992
Creating a query object from a text file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 994
Using the cfhttp Post method. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 996
Performing file operations with cfftp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 999
About interacting with remote servers
Transfer protocols are mechanisms for moving files and information from a source to one or more
destinations. Two of the more popular protocols are the Hypertext Transfer Protocol (HTTP) and
the File Transfer Protocol (FTP). ColdFusion has the
cfhttp and cfftp tags that let you use
these protocols to interact with remote servers.
The
cfhttp tag lets you receive a web page or web-based file, just as a web browser uses HTTP to
transport web pages. When you type a URL into a web browser, you make an HTTP request to a
web server. With the
cfhttp tag, you can display a web page, send variables to a ColdFusion or
CGI application, retrieve specialized content from a web page, and create a ColdFusion query
from a text file. You can use the Get or Post methods to interact with remote servers.
The
cfftp tag takes advantage of FTP’s main purpose—transporting files. Unlike HTTP, FTP
was not designed to interact with other servers for processing and interacting with data. After you
establish an FTP connection with the
cfftp tag, you can use it to upload, download, and manage
files and directories.