cfhttp 多部分 & Facebook
我正在使用 facebook graph api,并试图将图像发送到我的墙上。根据 Facebook 的说法,您只需发送图像、您的访问密钥和密码即可。标题...请参阅下面的代码:
<cfoutput>
<cfif fileexists("D:\myPath\images\menubar.jpg")>
<cfhttp method="post" url="https://graph.facebook.com/me/photos" multipart="yes">
<cfhttpparam type="formfield" name="access_token" value="myAccessToken">
<cfhttpparam type="file" name="source" file="D:\myPath\images\menubar.jpg">
<cfhttpparam type="formfield" name="message" value="this is a test picture.">
</cfhttp>
<cfdump var="#cfhttp#">
</cfif>
</cfoutput>
当我运行此代码时,我收到 400 bad request 错误(从 facebook 返回“OauthException 发生未知错误”)。有谁知道我做错了什么?谢谢!
I'm playing with the facebook graph api, and was attempting to send an image to my wall. According to facebook, you just send the image, your access key & a caption... see below my code:
<cfoutput>
<cfif fileexists("D:\myPath\images\menubar.jpg")>
<cfhttp method="post" url="https://graph.facebook.com/me/photos" multipart="yes">
<cfhttpparam type="formfield" name="access_token" value="myAccessToken">
<cfhttpparam type="file" name="source" file="D:\myPath\images\menubar.jpg">
<cfhttpparam type="formfield" name="message" value="this is a test picture.">
</cfhttp>
<cfdump var="#cfhttp#">
</cfif>
</cfoutput>
When I run this, I get a 400 bad request error ("OauthException an unknown error occurred" returns from facebook). Does anyone know what I'm doing wrong? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当安全证书尚未导入 Java/ColdFusion 密钥库时,我在使用 https 时遇到了问题。有关如何实现此目标的更多信息,请访问:
http://kb2.adobe.com/cps/ 400/kb400977.html
希望有帮助!
I've run into issues using https when the secure certificate hasn't been imported into the Java/ColdFusion keystore. More info on how to achieve that here:
http://kb2.adobe.com/cps/400/kb400977.html
Hope that helps!
你能检查你的访问令牌格式吗?
通常参数设置为
access_token=somedata&expires=sometimestamp
在上面提到的语句中,您必须按字面意思传递访问令牌。我这里加粗了。 access_token=somedata&expires=sometimestamp
我已经尝试解决同样的问题近3个小时了。 :) 终于做到了!
can you check your access token format?
usually parameters set as
access_token=somedata&expires=sometimestamp
At the statement you mentioned above, you have to pass just access token literally. I make it bold here. access_token=somedata&expires=sometimestamp
I've been trying to solve the same problem nearly for 3 hours. :) and finally did!