Curl 调用 ColdFusion - Instagram [英] Curl call to ColdFusion - Instagram

查看:18
本文介绍了Curl 调用 ColdFusion - Instagram的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 cURL 完全没有经验,但据我所知,它相当于 cfhttp.

I'm not experienced with cURL at all, but from what I can gather, it's equivalent to cfhttp.

我想使用 Instagram API 并验证用户身份.他们的示例使用了 cURL.

I want to work with the Instagram API and authenticate a user. Their example uses cURL.

curl \-F 'client_id=CLIENT-ID' \
    -F 'client_secret=CLIENT-SECRET' \
    -F 'grant_type=authorization_code' \
    -F 'redirect_uri=YOUR-REDIRECT-URI' \
    -F 'code=CODE' \https://api.instagram.com/oauth/access_token

我认为 CF 版本是否正确:

Would I be correct in thinking the CF version would be:

<cfhttp url="https://api.instagram.com/oauth/access_token" method="post" resolveurl="true">
    <cfhttpparam type="formField" name="client_id" value="CLIENT-ID" />
    <cfhttpparam type="formField" name="client_secret" value="CLIENT-SECRET" />
    <cfhttpparam type="formField" name="grant_type" value="authorization_code" />
    <cfhttpparam type="formField" name="redirect_uri" value="YOUR-REDIRECT-URI" />
    <cfhttpparam type="formField" name="code" value="code" />
</cfhttp>

我还不能尝试这个,因为直到很久以后我才会在我的开发机器上,所以我现在只是在挖掘可能性并制作伪代码(未经测试!).

I'm not able to try this yet as I won't be at my development machine until a lot later, so I'm just digging around right now looking at possibilities and making pseudo-code (not tested!).

任何对 Instagram API 和 ColdFusion 有具体经验并能提供一些见解的人都将不胜感激.

Anyone with specific experience with the Instagram API and ColdFusion who could shed some insight would be greatly appreciated.

我正在使用 Railo.

I'm using Railo.

推荐答案

根据cURL的使用方式,-F选项是表单数据.

According to how to use cURL the -F option is form data.

http://curl.haxx.se/docs/manpage.html

因此,您将要发送表单数据,而不是 cfhttpparam 标签中的 url 数据.

So you're going to want to send form data, not url data in your cfhttpparam tags.

<cfhttp url="https://api.instagram.com/oauth/access_token" method="post" resolveurl="true">
    <cfhttpparam type="formField" name="client_id" value="CLIENT-ID" />
    <cfhttpparam type="formField" name="client_secret" value="CLIENT-SECRET" />
    <cfhttpparam type="formField" name="grant_type" value="authorization_code" />
    <cfhttpparam type="formField" name="redirect_uri" value="YOUR-REDIRECT-URI" />
    <cfhttpparam type="formField" name="code" value="code" />
</cfhttp>

我对 Instagram API 一无所知,只了解我在上述链接中读到的有关 cURL 的内容,因此这可能不是完整的解决方案,但看起来您走在正确的轨道上.

I don't know anything about the Instagram API and only what I read in the above link about cURL so this may not be the complete solution but it looks like you're on the right track.

这篇关于Curl 调用 ColdFusion - Instagram的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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