我正在尝试使用此示例中的 ColdFusion cfhttp 来模拟此 curl 请求:
https://docs.fatzebra.com.au/purchases
在 linux 终端中,curl 请求可以完美运行
<cfset origTemp = '
\{ \
\"card_holder\": \"Jim Smith\", \
\"card_number\": \"5123456789012346\", \
\"card_expiry\": \"05/2014\", \
\"cvv\": \"987\", \
\"amount\": 1000, \
\"reference\": \"zzzzsORD98976\", \
\"customer_ip\": \"111.222.111.123\" \
}'/>
<cfset tmp = {} />
<cfset tmp['card_holder'] = "Jim Smith" />
<cfset tmp['card_number'] = '512345678901234a6' />
<cfset tmp['card_expiry'] = '05/2013' />
<cfset tmp['cvv'] = '987z' />
<cfset tmp['amount'] = 'a1000' />
<cfset tmp['reference'] = 'ORD98976' />
<cfset tmp['customer_ip'] = '111.222.111.123' />
<cfhttp url='https://gateway.sandbox.fatzebra.com.au/v1.0/purchases' useragent="#cgi.http_user_agent#" username="Test" password="Test" result="r" method="post" >
<cfhttpparam type="header" name="content-type" value="application/json" />
<!---<cfhttpparam type="body" value="#origTemp#" />--->
<cfhttpparam type="body" value="#serializeJson(tmp)#" />
</cfhttp>
<cfdump var="#r#" />
没有任何运气。