Skip to main content
Known Participant
June 10, 2006
Question

Form Redirect

  • June 10, 2006
  • 18 replies
  • 1656 views
Hi, I'm trying to redirect a form post from one http sever to another.
I have two coldfusion pickupdepot scripts that accept IPN posts from paypal. Sometimes paypal posts to the wrong one, so here is what i need to do.
I want pickupdepot1 to redirect certain posts to the other pickupdot2. I know its not as simple as a redirect.
I want pickupdepot1 to see the incoming post from paypal, then based on my query, Just forward the post to another url. can this be done?

Thanks

Tony Paolillo
This topic has been closed for replies.

18 replies

TonyPAuthor
Known Participant
July 27, 2006
Most of the thanks goes to you for helping. I learned about CFHTTP and you steered me in the right direction.

Thanks Again.

Tony
BKBK
Community Expert
Community Expert
July 27, 2006
This works great.
Nice you found what you've been looking for; even nicer you found it.

TonyPAuthor
Known Participant
July 27, 2006
Hi BKBK, Thanks fo ryour help. Here is the solution that I used:
<cfif #form.business# eq "payments@mydomain.com">
<cfhttp method="Post" url=" http://www.mydomain.com/pickupdepot/ipnpage_cfpp.cfm">
<cfloop index="locfield" list="#form.fieldnames#">
<cfhttpparam type="Formfield" value="#urldecode(evaluate(locfield))#" name="#locfield#">
</cfloop>
<cfhttpparam type="Formfield" value="Verified" name="cfpp_verification">
</cfhttp>
<!--- The System has sent the data to The New Pickup Depot and now is going to Abort! --->
<cfabort>
</cfif>

This works great. It sends the data over then aborts.
Thanks for all your help

Tony
TonyPAuthor
Known Participant
June 14, 2006
To keep the quality of this forum high, Ill ignore MikerRoo.
I like the idea of just running a loop, proccessing the form vars as you said BKBK, Then I could use java to post the form to the other server.
That should work. Im diggin that idea.

Ill let you know how it goes, Thanks again

Tony
BKBK
Community Expert
Community Expert
June 14, 2006
However I dont see that as being a feasable solution. I would have to ping the other server or something to let the other server know that there was a purchase for them and "come get it". Also would have to open a door for access from the other server.
All of that is not necessary at all. After processing the form, the first server only has to open the page on the second server that runs the query.

Couldn't I somehow grab the form vars comming in and maybe wrap them in a wddx packet or somehow RE-proccess the form vars and the POST it to another url?
If you insist that the variables must arrive at the second server as form-scoped variables, then proceed as follows. After receiving the form variables at pickupdepot1 dynamically create a new form whose action attribute is " http://www.pickupdepot2.com/ipnscript.cfm". Create a field with the same name as each field of the incoming form. Give each the value that corresponds to the name. For example,

<input type="hidden" name="ITEM_NAME" value="#FORM.ITEM_NAME#">

When the dynamic form is submitted to pickupdepot2, the variables will arrive there as form-scoped variables.


June 14, 2006
quote:

Originally posted by: BKBK
All of that is not necessary at all. After processing the form, the first server only has to open the page on the second server that runs the query.



You're quite right. Your suggestion should have worked for legitimate needs. (Although proper server configuration is the best solution)

That it didn't, means that TP is either a moron or a hacker (or both).

Form repost techniques, across servers, are used by phishers.
Do you want to help a hacker?
TonyPAuthor
Known Participant
June 14, 2006
Hi BKBI, I already save all the incoming data to a database. However I dont see that as being a feasable solution. I would have to ping the other server or something to let the other server know that there was a purchase for them and "come get it". Also would have to open a door for access from the other server.
Couldn't I somehow grab the form vars comming in and maybe wrap them in a wddx packet or somehow RE-proccess the form vars and the POST it to another url?I already have somehting like this:
<cfloop index="locfield" list="#form.fieldnames#">
<cfset locfield=urldecode(evaluate(locfield))>
</cfloop>
that converts the posted vars to local vars, So i know we can proccess the incomming vars. Now just what do we do with them. Maybe proccess them into a struct and then send the struct to another server?
One thing though, However it does it, The recieving end is looking for posted data from a form. I can change the script to allow ANY data from this other server, but it must be posted to this script.

There has to be a way that I can either roll up the form vars and the post it to another url, or bounce the post to another url. I wish i knew what it was.


Thanks

Tony

BKBK
Community Expert
Community Expert
June 13, 2006
I will try the forward() script.
No need.

Will the forward() still work?
It wont, the reason being that the argument, x, in getPageContext().forward(x) must be a relative URL.

Here's a good way to pass form variables from one server, pickupdepot1, to another, pickupdepot2. While you're on pickupdepot1, store the form variables to a database. At pickupdepot2, read the variables from the database.

TonyPAuthor
Known Participant
June 13, 2006
I will try the forward() script. The links are like this: " http://www.pickupdepot1.com/ipnscript.cfm" would get forwarded to " http://www.pickupdepot2.com/ipnscript.cfm".

Will the forward() still work?
BKBK
Community Expert
Community Expert
June 12, 2006
You cannot use .forward to redirect to ANOTHER server.
Mr Black, I thought TonyP sought to redirect to another page, not to another server. Your point, that forward() is not a solution from one server to another, is correct. However, I cannot see any advantage in carrying out the process on two servers.



BKBK
Community Expert
Community Expert
June 12, 2006
Im just not sure of the <http> syntax to send the posted data to another url. For some reason its just not hitting me.

This works. Try it.

pickupdepot1.cfm
===============
<!--- The CFHTTP to PayPal has just run. This block contains variables from PayPal in form scope, say, form.x, form.y, etc --->
<cfscript>
Request.z = getHTTPRequestData().content;
getPageContext().forward("pickupdepot2.cfm");
</cfscript>

pickupdepot2.cfm
===============
<cfdump var="#Request#">