How to get the URL from a CFHTTP post

I'm posting formfields to an application using CFHTTP.  The application returns the variable named "status" indicating if the data is correct or not. When I output the cfhhtp.filecontent I only see the action page but the return variable is displayed only in the URL of the action page.. How do I get the URL from the action page to be displayed?

<cfhttp method="POST"   URL="http://actionpage.asp" resolveurl="yes">
<cfhttpparam type="Formfield" Name="First_Name" value=#fname#>
<cfhttpparam type="Formfield" Name="Last_Name" value=#lname#>
<cfhttpparam type="Formfield" Name="Email" value=#email#>
</cfhttp>
  <cfoutput>#cfhttp.FileContent#</cfoutput>

The action page displays “Thank You for Submiting your Info”

The url of the action page looks like http://actionpage.asp?response=accepted  or  http://actionpage.asp?response=rejected

I’m not able to capture the variable “response”
gaby22Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dlewis9Commented:
Can you modify the ASP page?  I'm not sure it can be done otherwise..I tried a few things with the response header, but no luck.

If you can modify the ASP page, the easiest thing to do is just have it return the value you want and then have CF display the "Thank You" message.
0
Tacobell777Commented:
Try <cfdump var="#cfhttp#"> and see if there is anything in there that you can use.
0
INSDivision6Commented:
The URL of HTTP request is (by definition) is the same, at it is provided in the original CFHTTP.  If the URL is different, it means the redirection took place.  If you want to know the URL where request was redirected (and this looks like your case), you have to follow the following scenario:

1. Issue original CFHTTP with redirects disabled:
   <cfhttp method="POST"   URL="http://actionpage.asp" resolveurl="yes" redirect="no">
   <cfhttpparam type="Formfield" Name="First_Name" value=#fname#>
   <cfhttpparam type="Formfield" Name="Last_Name" value=#lname#>
   <cfhttpparam type="Formfield" Name="Email" value=#email#>
   </cfhttp>

2. See what is the cfhttp.statusCode.  If this is "200", the request is complete.  If this is "30x" (usually, 302), the redirection URL can be found as:
   <cfset newURL=cfhttp.responseHeader[LOCATION]>
   Analyze this string to see whether "actionpage.asp?response=accepted"  or "actionpage.asp?response=rejected" was returned.

3. Issue another CFHTTP "GET" request to redirection URL to complete the request.  Note that, if the first URL sets cookies and they are needed on the redirection page, you have to capture them from response header and provide with the second CFHTTP call.

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Servers

From novice to tech pro — start learning today.