使用 facebook javascript sdk - 我制作了这个函数来将信息发布到当前 facebook 用户的墙上。
但我确信这是正确的(显然不是),但在任何地方都找不到语法错误。
仅当我单击“发布到墙上”按钮时才会出现该错误。任何人都可以帮助我理解为什么会出现错误吗?
谢谢乔什
请在下面查看我的完整标签应用程序代码。
<?php
require 'facebook-php-sdk-master/src/facebook.php';
$fb_app_id = 'XXXXXXXXXXXXXXX';
$fb_secret = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
$fb_admins = 'XXXXXXXXX';
$fb_channel_url = '//myapp.co.uk';
$og_title = 'My App';
$og_description = 'This is my app';
$facebook = new Facebook(array(
'appId' => $fb_app_id,
'secret' => $fb_secret,
'cookie' => true
));
$signed_request = $facebook->getSignedRequest();
?>
<!DOCTYPE html>
<head>
<meta name="robots" content="noindex, nofollow">
<meta charset="utf-8">
<meta property="fb:app_id" content="<?php echo $fb_app_id; ?>">
<meta property="fb:admins" content="<?php echo $fb_admins; ?>">
</head>
<body>
<a href="#" onclick="fb_publish('<?php echo $fb_app_url; ?>','<?php echo $og_title; ?>','Image URL Here','<?php echo $og_description; ?>'); return false;">Post to wall</a>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '<?php echo $fb_app_id; ?>', // App ID
channelUrl : '<?php echo $fb_channel_url; ?>',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
FB.Canvas.setAutoGrow(true);
};
function fb_publish(link,title,image,description) {
var obj = {
method: 'feed',
link: link,
picture: image,
name: title,
caption: 'facebook.com/mypage',
description: description
};
function callback(response) {
}
FB.ui(obj, callback);
}
/***** load SDK *****/
(function(d){
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
ref.parentNode.insertBefore(js, ref);
}(document));
</script>
</body>
</html>