将cURL调用转换为Coldfusion(cfhttp) [英] Converting cURL call to Coldfusion (cfhttp)

查看:158
本文介绍了将cURL调用转换为Coldfusion(cfhttp)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能很简单,不完全确定。有没有办法采取这个cURL调用下面(它是从大商业的API)和重写相同的函数使用cfhttp?我知道cfhttp行为(或可以像)一个form / method =post类型交易,但我不知道什么params(或他们的名字应该)在一个cfhttp标签中使用。任何帮助将不胜感激...我的目标是能够使用Coldfusion调用产品列表,在这一点,我可以安排/导出到列表/ Excel /任何,但设置实际调用使用cfhttp和转换这个cURL调用是我困在的。

This may be pretty simple, not entirely sure. Is there a way to take this cURL call below (it's from Big Commerce's API) and rewrite the same function using cfhttp? I know cfhttp acts (or can act like) a form/method="post" type deal, but I'm not sure what params (or what their names should be) to use within a cfhttp tag. Any help would be appreciated...my goal is to be able to use Coldfusion to call a list of products, at which point I can arrange/export to a list/excel/whatever, but setting up the actual call using cfhttp and converting this cURL call is what I'm stuck at.

curl --request GET \
 --user-agent "Your Client Name/1.0" \
 --header "Authorization: Basic YWRtaW46WW91ckFQSUtleUhlcmU=" \
 https://www.example.com/api/v2/products


推荐答案

应该是:

<cfhttp
    method="get"
    url="https://www.example.com/api/v2/products"
    userAgent="Your Client Name/1.0">
    <cfhttpparam type="header" value="Authorization: Basic YWRtaW46WW91ckFQSUtleUhlcmU=">
</cfhttp>

这篇关于将cURL调用转换为Coldfusion(cfhttp)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆