我有一个用 php 编写的博客网站,它将新的博客文章发布到 twitter,并在后台使用使用 php curl 传递的简单 http post 请求自动进行博客 ping。
我有一个博客网站的 Facebook 页面,并且希望将更新发布到页面上的墙上,有没有简单的方法可以做到这一点?
我真正想要的是一个 url 和一组参数来打包为 http post 请求。
请注意,这是在新样式页面而不是个人资料上发布到墙上。
从以下位置获取 PHP SDKgithub并运行以下代码:
<?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);
上面的代码会将消息发布到您的墙上...如果您想发布到您的朋友或其他人的墙上,请替换me
与该用户的 Facebook 用户 ID。有关更多信息,请参阅 API 文档。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)