Copy link to clipboard
Copied
Hey guys, I have a ColdFusion question.
I have a simple form where a customer infputs their name and email address. The action takes the customer to a secondary page where I use <cfmail> emails them a coupon code and <cfhttp> sends all the coupon variables to a third party who operates our web store. Currently, the <cfmail> works perfectly; however, the <cfhttp> does not do its job.
The code is below. Anyone see what I'm doing wrong?
<CFPARAM name= form.name default="">
<CFPARAM name= form.email default="no email addy <webmaster@company.com>">
<cfset randomNumber=RandRange(10000, 99999)>
<cfset coupon="VIDEOMAKER">
<cfset resale="10">
<cfset resaleType="percent">
<cfset numDays="3">
<cfset qtyLimit="10">
<cfset description="10% Off for Videomaker Readers">
<cfset username="gtech">
<cfset password="cdsa3455">
<cfset couponName="#randomNumber##coupon##resale#OFF">
<cfmail to="#form.name# <#Form.email#>" bcc="webmaster@company.com"
from="Coupon Server <coupons@company.com>"
subject="Videomaker Discount Coupon for #form.Name#"
username="support@company.com"
password="6787">
<cfif form.name is not "">#form.Name#,</cfif>
Your personal coupon code to receive #resale#% off all Products is below.
CODE: #randomNumber##coupon##resale#OFF
Just enter this code in the shopping cart and save #resale#% instantly!
Your coupon will expire in #numdays# days.
-------------------------------------------------------
Have a Great Day!
The coupon Server
</cfmail>
<cfhttp
method="Post"
url="https://company.nowdirect.com/exec/gbackcoupon.tsb">
<cfhttpparam
name="discount"
type="url"
value="?couponName=#couponName#&coupon=#coupon#&re sale=#resale#&resaleType=#resaleType#&numDays=#num Days#&qtyLimit=#qtyLimit#&description=#description #&username=#username#&password=#password#"
>
</cfhttp>
Copy link to clipboard
Copied
First questions first.
Have you taken the steps required to allow ColdFusion to make secure HTTPS requests of another server?
There is a good chance that you need to import a security certificate into the key store so that ColdFusion and this server and exchange the desired information in the desired encryption.
Here is the first blog I found on the topic.
http://mkruger.cfwebtools.com/index.cfm?mode=entry&entry=8E44925A-B73D-E3AD-709D4E02FD6D4588
There are plenty of good tech-notes, walk throughs and how to's on what needs to be done, if this is required.
Copy link to clipboard
Copied
I'm told that we have taken the proper steps to make secure HTTPS requests. I was given some advice to rewrite the code as following:
<cfhttp
method="Get"
url="https://company.nowdirect.com/exec/coupon.tsb">
<cfhttpparam name="couponName" value="#couponName#" type="url" />
<cfhttpparam name="coupon" value="#coupon#" type="url" />
<cfhttpparam name="resale" value="#resale#" type="url" />
<cfhttpparam name="resaleType" value="#resaleType#" type="url" />
<cfhttpparam name="numDays" value="#numDays#" type="url" />
<cfhttpparam name="qtyLimit" value="#qtyLimit#" type="url" />
<cfhttpparam name="description" value="#description#" type="url" />
<cfhttpparam name="username" value="#username#" type="url" />
<cfhttpparam name="password" value="#password#" type="url" />
</cfhttp>
Copy link to clipboard
Copied
Is the receiving site expecting url or form variables?
Copy link to clipboard
Copied
Sorry, I didn't complete the message. They are expecting url with the name / value pairs as query string.
Copy link to clipboard
Copied
They are expecting