卷曲调用的ColdFusion - Instagram的 [英] Curl call to ColdFusion - Instagram

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

问题描述

我不跟卷曲经验可言,但是从我所知,这是相当于CFHTTP。

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

我想用Instagram的API工作和验证用户。他们的例子使用卷曲。

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>

我不能够没有尝试这个,因为我不会在我的机器,直到后来很多,所以我只是四处现在看可能性,使伪code(未测试!)。

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的具体经验谁能够摆脱一些有识之士将不胜AP preciated。

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

我使用Railo。

推荐答案

据如何-f选项表单数据使用卷曲。

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

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

所以,你要想要发送表单数据,而不是URL数据在cfhttpparam标签。

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任何东西,只是我在大约卷曲上面的链接阅读所以这可能不是完整的解决方案,但它看起来就像你在正确的轨道上。

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.

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

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