If you are using CFHTTP to retrieve a page via HTTP GET and are getting different results than when you browse there with a web browser, one common cause for this is that the page being retrieved is checking the http request headers and modifying its response based on one or more of those headers.

A web browser will generally send much more detailed request headers than the default request headers that CFHTTP generates. However, you can add your own http request headers when using CFHTTP to simulate the request coming from a standard web browser using the 'cfhttpparam' tag with 'type="CGI"'.

Below is an example of how to add an 'Accept' header to your CFHTTP request:
Code:
<cfhttpparam encoded="no" type="CGI" name="accept" value="text/html">
This lets the target page know what type of content we will accept. In this case, we set the value to 'text/html'. however, we could also specify something like 'text/xml' if we wanted only an xml result or 'text/html,text/xml' if we want to accept both.


David D.