用 PHP 发布到 facebook 流
我一直在尝试用这种JS方法完成流发布:
function streamPublish(name, description, hrefTitle, hrefLink, userPrompt){
FB.ui(
{
method: 'stream.publish',
message: '',
attachment: {
name: name,
caption: '',
description: (description),
href: hrefLink
},
action_links: [
{ text: hrefTitle, href: hrefLink }
],
user_prompt_message: userPrompt
},
function(response) {
});
}
但它在Internet Explorer上不起作用。如何在 PHP 中实现相同的结果(或者对于发布到用户流的 facebook 应用程序而言被视为“标准”的任何结果)? facebook API 文档很差并且不包含很多代码示例。
I've been trying to accomplish stream publishing with this JS method:
function streamPublish(name, description, hrefTitle, hrefLink, userPrompt){
FB.ui(
{
method: 'stream.publish',
message: '',
attachment: {
name: name,
caption: '',
description: (description),
href: hrefLink
},
action_links: [
{ text: hrefTitle, href: hrefLink }
],
user_prompt_message: userPrompt
},
function(response) {
});
}
but it never works on Internet Explorer. How can I achieve this same result (or whatever result would be considered "standard" for a facebook application posting to a user's stream) in PHP? The facebook API documentation is poor and doesn't include many code examples.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用 Facebook PHP SDK 中的 api 函数,如下所示:
其中 $attachment 是这样构建的对象:
您可以在 facebook 开发人员网站上检查其他类型的参数以与附件一起传递
Use the api function from the Facebook PHP SDK like this:
Where $attachment is an object built this way:
You can check other kind of params to pass with the attachment on the facebook developers website
自 6 月 3 日起,API 调用应包含 access_token。
因此请小心包含
'access_token' => ACCESS_TOKEN, 位于
$attachment
数组中。@med:Med,您是否检查过您的图像是否可以公开访问(即,您的机器在 Intranet 中不提供服务)?好像图片无法访问。
As of June 3rd, the API call should include the access_token.
So be careful to include
'access_token' => ACCESS_TOKEN,
in the$attachment
array.@med: Med, have you checked if your image is publicly accessible (i.e. not served by your machine in an intranet)?. It seems like the image can't be accessed.