使用PHP-SDK向朋友推荐页面 [英] Suggest Page to friends using PHP-SDK
本文介绍了使用PHP-SDK向朋友推荐页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用PHP-SDK或使用JavaScript SDK实现向朋友推荐MY-PAGE?
How to implement "Suggest MY-PAGE to friends" using PHP-SDK or using Javascript SDK?
推荐答案
需要包含base_facebook.php,facebook.php和fb_ca_chain_bundle.crt的Facebook SDK软件包。您还需要fbmain.php和config.php。
First you need the Facebook SDK bundle that contains base_facebook.php, facebook.php and fb_ca_chain_bundle.crt . You will also need fbmain.php and config.php .
接下来,您应该有一个文件(例如postToWall.php),其中包含fbmain.php
Next you should have a file (e.g postToWall.php) that includes fbmain.php
<?php
include_once "fbmain.php";
?>
postToWall.php文件的一个例子。
An example of postToWall.php file.
<html>
<body id="my_body">
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId: '<?php echo $facebook->getAppID() ?>',
cookie: true,
xfbml: true,
oauth: true
});
FB.Canvas.setAutoGrow();
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>
<?php
if ($me)
{
$params = array('message' => "message here",
'picture' => "picture hyperlink here",
'name' => "name here",
'link' => "facebook page hyperlink here",
'description' => " description here"
);
$status = $facebook->api('/me/feed', 'POST', $params);
if (isset($status['id']))
{
//do something
}
}
?>
</body>
</html>
给我的导师,禅宗先生
这篇关于使用PHP-SDK向朋友推荐页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文