我在使用经典asp发布到Facebook墙时遇到问题。变量fbName,fbUserID,accessToken在“现实生活中”设置 - 我刚刚删除它。我有正确的权限发布到用户墙(“publish_stream”)。
该帖子未发布在用户的Facebook墙上。我犯了什么错误吗?
fbName = ""
fbUserID = ""
accessToken = ""
strURL = "https://graph.facebook.com/" & fbUserID & "/feed"
strMessage = fbName & " just did something."
strLink = "http://www.orf.at/"
strAccessToken = accessToken
para = "?access_token=" & strAccessToken & "&message=" & strMessage & "&link=" & strLink
set xmlDoc = createObject("MSXML2.DOMDocument")
xmlDoc.async = False
xmlDoc.setProperty "ServerHTTPRequest", true
bLoaded = xmlDoc.load(strURL & para)
对不起,我无法回答我自己的问题。但这是正确的解决方案:
正确答案是:
Dim xmlHttp
Dim res
set xmlHttp = CreateObject("MSXML2.ServerXMLHTTP")
xmlHttp.Open "POST", strURL & para, false
xmlHttp.setRequestHeader "Content-type","application/x-www-form-urlencoded"
xmlHttp.send
要获取一些错误:
res = xmlHttp.responseText
Response.Write "res: " & res & "<br>"
Response.Write "Status: " & xmlHttp.Status & "<br>"
答案 0 :(得分:0)
您好像没有使用Http Post请求。你需要这样的东西(未经测试)
Dim xmlHttp
set xmlHttp = CreateObject("Microsoft.xmlHttp")
xmlHttp.Open "POST", strURL & para
xmlHttp.setRequestHeader "Content-type","application/x-www-form-urlencoded"
xmlHttp.setRequestHeader "Content-Length",len(sendData)
xmlHttp.send
Dim response
response = xmlHttp.responseText