CFHTTP Considerations
While CFHTTP
is extremely powerful, there are a
few limitations in the current version that are worth mentioning.
These issues include problems with CFHTTP
parsing
text files that don’t contain column headers and methods for
interacting with pages that require authentication. If you plan to
make heavy use of CFHTTP
, you should carefully
consider the issues discussed here.
Column Headers and Delimited Text Files
There is a problem with the
current implementation of CFHTTP
regarding the
parsing of text files (that don’t contain column headers) into
query objects. Using CFHTTP
to get a delimited
text file (that doesn’t contain column headers in the first row
of data) causes CFHTTP
to ignore the first row of
the file. This results in the first row of data in the text file
being left out of any subsequent operations. This occurs even if
alternate column headers are specified in the
COLUMNS
attribute. There is currently no
workaround for this problem other than ensuring that the first row of
the delimited file contains column headers or a dummy record. Example 14-8 illustrates this point, by showing how
CFHTTP
retrieves a text file (that contains stock quote information) from Yahoo’s web site. The text file doesn’t contain any column headers. In this case, it is possible to get a dummy record by having the CGI program that generates the file include a duplicate record for the first record. In this example, passing the ticker symbol “YHOO” twice in the URL does ...
Get Programming ColdFusion now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.