我尝试了许多使用 php sdk 发布用户墙的方法。但没有成功。任何人都知道成功发布到墙。请帮助我...此代码返回任何错误,但不会发布用户时间石灰。目前我正在使用这个php代码..
require_once('src/facebook.php');
$config = array(
'appId' => '#########',
'secret' => '#########################',
);
$facebook = new Facebook($config);
$user_id = $facebook->getUser();
echo $user_id;
$access_token = $facebook->getAccessToken();
if($user_id!=0)
{
try {$attachment = array(
'message' => "good Evening",
'name' => "good Evening",
'link' => "good Evening",
'description' => "good Evening",
'picture'=>"http://hotactresshotphotos.files.wordpress.com/2011/02/bhama_028.jpg",
'actions' => json_encode(array('name' => $action_name,'link' => $action_link))
);
$result = $facebook->api('/'.$user_id.'/feed', 'post', $attachment);
}
catch(FacebookApiException $e) {
$login_url = $facebook->getLoginUrl( array(
'scope' => 'publish_stream'
));
echo 'Please <a href="' . $login_url . '">login.</a>';
error_log($e->getType());
error_log($e->getMessage());
}
echo '<br /><a href="' . $facebook->getLogoutUrl() . '">logout</a>';
} else {
$login_url = $facebook->getLoginUrl( array( 'scope' => 'publish_stream' ) );
echo 'Please <a href="' . $login_url . '">login.</a>';
}