我有一个用PHP编写的博客网站,它发布了新的博客文章到Twitter和使用php curl传递的简单http post请求自动引导博客.
我有一个博客网站的Facebook页面,并希望更新发布到页面的墙上,有一个简单的方法来做到这一点?
我真正想要的是一个url和一组params作为http post请求包裹起来.
请注意,这是在新样式页面而不是配置文件上发布到墙上.
提前致谢.
Har*_*rup 65
从github获取PHP SDK 并运行以下代码:
<?php
$attachment = array(
'message' => 'this is my message',
'name' => 'This is my demo Facebook application!',
'caption' => "Caption of the Post",
'link' => 'http://mylink.com',
'description' => 'this is a description',
'picture' => 'http://mysite.com/pic.gif',
'actions' => array(
array(
'name' => 'Get Search',
'link' => 'http://www.google.com'
)
)
);
$result = $facebook->api('/me/feed/', 'post', $attachment);
Run Code Online (Sandbox Code Playgroud)
上面的代码会将消息发布到您的墙上...如果您想要发布到您的朋友或其他墙上,请替换me为该用户的Facebook用户ID ..有关详细信息,请查看API文档.
小智 9
这对我有用:
try {
$statusUpdate = $facebook->api('/me/feed', 'post',
array('name'=>'My APP on Facebook','message'=> 'I am here working',
'privacy'=> array('value'=>'CUSTOM','friends'=>'SELF'),
'description'=>'testing my description',
'picture'=>'https://fbcdn-photos-a.akamaihd.net/mypicture.gif',
'caption'=>'apps.facebook.com/myapp','link'=>'http://apps.facebook.com/myapp'));
} catch (FacebookApiException $e) {
d($e);
}
Run Code Online (Sandbox Code Playgroud)
Harish在这里有答案 - 除了你需要manage_pages在进行身份验证时请求权限,然后使用page-id而不是me在发布时....
$result = $facebook->api('page-id/feed/','post',$attachment);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
107885 次 |
| 最近记录: |