第一次涉足facebook图表,请原谅我的问题,如果修复有点容易...
我已经制作了我的应用程序,得到了我的所有appID和秘密,我正在尝试将页面发布到页面。我已经授予了应用程序权限,并进行了一些调试,但是在$ facebook-> api调用之后,它什么都没做......
我的代码如下:
<?php
require 'core/components/facebook/facebook.php';
$facebook = new Facebook(array(
'appId' => '****',
'secret' => '****',
));
// Get User ID
$user = $facebook->getUser();
if ($user) {
try {
$page_id = '****';
$page_info = $facebook->api("/$page_id?fields=access_token");
if( !empty($page_info['access_token']) ) {
$args = array(
'access_token' => $page_info['access_token'],
'message' => "Testing"
);
//An echo of $page_info['access_token'] gives me an access token...
$post_id = $facebook->api("/100160870061728/feed", "post", $args);
//Does not echo below - help!
echo "Success post id = " . $post_id;
}
else {
$permissions = $facebook->api("/me/permissions");
if( !array_key_exists('publish_stream', $permissions['data'][0]) || !array_key_exists('manage_pages', $permissions['data'][0])) {
header("Location: " . $facebook->getLoginUrl(array("scope" => "publish_stream, manage_pages")));
}
}
}
catch (FacebookApiException $e) {
error_log($e);
$user = null;
}
}
if ($user) {
$logoutUrl = $facebook->getLogoutUrl();
}
else {
$loginUrl = $facebook->getLoginUrl(array('scope' => 'manage_pages, publish_stream'));
}
?>
非常感谢提前