<cfhttp>
The Hypertext Transfer Protocol (HTTP) is the most common and generalized method for transferring information across the Web from servers to clients (browsers) and back again. Although it usually is associated with Hypertext Markup Language (HTML), HTTP is basically unlimited in the types of files it can transfer. In fact, both Web Services and Macromedia's Flash Remoting run on this protocol. Any file with a defined MIME (Multipurpose Internet Mail Extensions) type can be moved using this protocol. However, for large file transfer, it's recommended that you use FTP for transferring from server to server because of its optimization for this sort of action. FTP is covered in the "<cfftp>"section of this chapter.Through the <cfhttp> tag, ColdFusion can make an internal call, using the HTTP protocol, to the Web server in the same way a Web browser would. Think of this arrangement as a virtual Web browser. Keeping that in mind, the <cfhttp> tag is susceptible to all the same errors to which a Web browser is susceptible.Using the <cfhttp> tag, you can retrieve any Web page or Web-based file. The tag supports both the plain retrieval of information using the GET action, and an interactive retrieval (similar to a form posting) using the POST action. Again, remember that anything that can be done through a Web browser can be done through this tag. The latest release of ColdFusion also supports HEAD, PUT, DELETE, OPTIONS, and trACE methods. These will be discussed later.The <cfhttp> tag provides a variety of options, such as simply displaying a requested page, interacting with pages to retrieve specialized content, and building a ColdFusion query from a delimited text file. (Code examples that demonstrate these options are shown in the section "Putting the <cfhttp> Tag to Use" later in this chapter.)The standard tag syntax for <cfhttp> is as follows:
When using the POST operations, the <cfhttp> must be terminated with a closing tag; </cfhttp>. The GET operation does not require this termination. The <cfhttp> tag's final behavior can be changed depending on the value of the attributes supplied to it during execution. img src, a href, form action, applet code, script src, embed src, embed pluginspace, body background, frame src, bgsound src, -object data, object classid, object codebase, and object usemap.
<cfhttp url="url" method="get ">