我正在玩 facebook graph api,并试图将图像发送到我的墙上。根据 facebook,您只需发送图像、访问 key 和标题……请参见下面的代码:
<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 错误请求错误(“OauthException 发生未知错误”从 facebook 返回)。有谁知道我做错了什么?谢谢!
最佳答案
你能检查你的访问 token 格式吗?
通常参数设置为access_token=somedata&expires=sometimestamp
在您上面提到的语句中,您必须逐字传递访问 token 。我在这里加粗。访问 token = 一些数据 &expires=sometimestamp
我已经尝试解决同样的问题将近 3 个小时。 :) 终于做到了!
关于facebook - cfhttp 多部分和 facebook,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4587256/