如何在Facebook中使用API​​在PHP中发布墙壁? [英] How to post wall in facebook using API in PHP?

查看:74
本文介绍了如何在Facebook中使用API​​在PHP中发布墙壁?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

解决方案

请确保您拥有Facebook SDK
https://github.com/facebook/php-sdk



启动Facebook API

  $ facebook = new Facebook(array(
'appId'=> YOUR_APP_ID ,
'secret'=> YOU_APP_SECRET,
'cookie'=> true,
));

确保您的用户具有publish_stream扩展权限
然后调用Facebook图表Feed:

  $ facebook-> api(/ $ user / feed,'post',array b $ b'message'=>
'link'=>'http://mywebsite.com',
'picture'=>'http:// mywebsite。 com / picture.jpg',
'name'=>'MyWebSite',
'description'=>'MyWebSite是我的网站'

) ;


I want to post score in wall in facebook using facebook API.

解决方案

Make sure you have the Facebook SDK https://github.com/facebook/php-sdk

Initiate Facebook API

$facebook = new Facebook(array(
  'appId'  => YOUR_APP_ID,
  'secret' => YOU_APP_SECRET,
  'cookie' => true,
));

Make sure your user has the "publish_stream" extended permission then make a call to the facebook graph feed:

            $facebook->api("/$user/feed", 'post', array(
                'message' => "Hi",
                'link'    => 'http://mywebsite.com',
                'picture' => 'http://mywebsite.com/picture.jpg',
                'name'    => 'MyWebSite',
                'description'=> 'MyWebSite is a website for me!'
                )
            );

这篇关于如何在Facebook中使用API​​在PHP中发布墙壁?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆