Skip to main content
Participant
July 29, 2009
Question

CFHTTP Questions

  • July 29, 2009
  • 1 reply
  • 709 views

I have what seems like a very simple task.

I need to use cfhhtp to browse a page and save the contents to a file on the server

My code is:

<cfhttp method="GET" url="https://manage.sprintpcs.com/specialoffers/CheckRebate.do?dispatch=checkRebate&phoneNumber=7815401785&zipCode=02494" resolveurl="Yes" port="443">

</cfhttp>

<cfoutput>#cfhttp.filecontent#</cfoutput>

Seems easy enough...  try it...  see that the results of the cfhhtp are different than the actual data that gets returned from viewing the url in a browser.

Any ideas?

There HAS to be a way to do this with ColdFusion.

This topic has been closed for replies.

1 reply

August 2, 2009

When you make a request with CFHTTP the User Agent that is provided to the Web Server at the other end is going to be "ColdFusion" unless you change it to reflect another user agent.  It is not uncommon to for developers to check the user agent and then display a different page depending on the results.  For example I often provide text only templates to ligit spiders.  My Guess is that if you add change the user agent by adding the userAgent parameter property to the cfhttp call and specifying a different common user agent you will get a different result.

-Joe