Solved

Is there a way to simulate an http post command in coldfusion?

Posted on 2004-09-30
14
373 Views
Last Modified: 2013-12-20
Hey,
I need to basically simulate the submission of a form to a remote server from within coldfusion... is this possible? If so how do I do it?


Cheers,
Rick
0
Comment
Question by:richardsimnett
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 4
  • 2
  • +1
14 Comments
 
LVL 6

Expert Comment

by:campbelc
ID: 12192986
Sorry maybe I can help. What are you looking to accomplish with this?
0
 

Author Comment

by:richardsimnett
ID: 12193097
Basically,
We are writing a coregistration / marketing site for one of our clients. He wants to place 1 page ads with forms on different pages. But we do not want the visitor to leave the site. So the form submits back to our site, and then we'd like to trigger off a http post command from within the processign page, to the advertisers remote server, and submit the data to them like it was a form post directly to them.

I hope that makes sense.

-Rick
0
 
LVL 6

Expert Comment

by:campbelc
ID: 12193235
Ok, so when they submit the page, do just that, submit the page and not leave the url they are currently looking at while posting the data to a remote server?
0
Why You Need a DevOps Toolchain

IT needs to deliver services with more agility and velocity. IT must roll out application features and innovations faster to keep up with customer demands, which is where a DevOps toolchain steps in. View the infographic to see why you need a DevOps toolchain.

 

Author Comment

by:richardsimnett
ID: 12193252
campbelc,
yes exactly that.

-Rick
0
 
LVL 6

Expert Comment

by:campbelc
ID: 12193340
Can you use an iframe set to 1px by 1px? Maybe not super sexy but should work.

Need an example?
0
 

Author Comment

by:richardsimnett
ID: 12193358
Can you please provide and example for me. I dont know exactly what you mean.

Cheers,
Rick
0
 
LVL 6

Expert Comment

by:campbelc
ID: 12193544
Sure try this..

Inital form is located at www.rml-lab.com and the form is being posted to www.mybowlingstats.com

Here is a sample:

http://www.rml-lab.com/experts-exchange/form.cfm
0
 
LVL 6

Expert Comment

by:campbelc
ID: 12193585
What's happening here is the form (your site) when submitted is submitted to the iframe instead of the entire page submitting just the iframe does. You can set the iframe to 0 x 0 to make it invisible and should work great.
0
 

Author Comment

by:richardsimnett
ID: 12193617
Campbelc,
That wont work as the form also needs to be submitted to our database at the same time. Any other ideas of how to do this?

Cheers,
Rick
0
 
LVL 17

Expert Comment

by:Tacobell777
ID: 12193827
no need for iframes, use cf's tag cfhttp and you can simulate a post exactly like you said..

http://livedocs.macromedia.com/coldfusion/6/CFML_Reference/Tags-pt154.htm
0
 
LVL 6

Expert Comment

by:campbelc
ID: 12193857
I can do this, but not real clean. Will include some javascript. That ok? =(
0
 
LVL 6

Assisted Solution

by:campbelc
campbelc earned 200 total points
ID: 12194145
Ok Rick, taking Taco's suggestion, try this:

This is a form that would accept your input then submit it to the iframe so your client won't leave your page, all the while submitting the form to two different locations.


<cfparam name="url.a" default="">
<cfif url.a is not "post">
<cfoutput>#now()#</cfoutput>
<form action="test.cfm?a=post" method="post" target="iframe1">
  <input type="Text" size="25" name="name1">
  <input type="Submit">
</form>
<!----- sets a default value for a URL to retrieve ----->

<iframe name="iframe1" height="100" width="600" frameborder="0">
<cfelse>
 <cfoutput>
  <cfhttp method="post" url="http://www.rml-lab.com/post.cfm" resolveurl="true">
    <cfhttpparam type="Formfield" value="#form.name1#" name="address">
  </cfhttp>
  <cfhttp method="post" url="http://www.mybowlingstats.com/post.cfm" resolveurl="true">
    <cfhttpparam type="Formfield" value="#form.name1#" name="address">
  </cfhttp>
 </cfoutput>
</cfif>
</iframe>
0
 
LVL 7

Expert Comment

by:INSDivision6
ID: 12194361
What all that frame business about?  Use plain CFHTTP.  Ultimate answer: read documentation first.
0
 
LVL 17

Accepted Solution

by:
Tacobell777 earned 300 total points
ID: 12195030
yeah, there is no need for frames, just post the form, and on the action page use cfhttp

<cfhttp method="post" url="http://www.rml-lab.com/post.cfm" resolveurl="true">
    <cfhttpparam type="formfield" value="#form.name1#" name="address">
</cfhttp>
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Objective of This Article In 1990’s, when I was a budding software professional, I had a lot of confusion about which stream or technology, I had to choose to build my career. In those days, I had lot of confusion like whether to choose System so…
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question