0
저는 페이스 북에서 응용 프로그램을 만들고 php sdk 사이에서 내 프로필에 내 사이트의 기사를 게시 할 수 있습니다.내 팬 페이지에 내 사이트에서 게시하고 싶습니다
이제 내 기사를 내 fanpage에 게시하고 prfile에 게시하고 싶지 않습니다. 내가 어떻게 할 수 있니?
// Remember to copy files from the SDK's src/ directory to a
// directory in your application on the server, such as php-sdk/
require_once('facebook.php');
$config = array(
'appId' => 'xxxxxxxxxxxxx',
'secret' => 'xxxxxxxxxxxxxxxxx',
);
$facebook = new Facebook($config);
$user_id = $facebook->getUser();
?>
<?
if($user_id) {
// We have a user ID, so probably a logged in user.
// If not, we'll get an exception, which we handle below.
try {
$access_token = $facebook->getAccessToken();
$page_id='xxxxxxxxxxxxxx';
$ret_obj = $facebook->api('/me/feed', 'POST',
array(
'link' => $link,
'message' => $titolo,
'picture' => 'http://xxxxxxxxxxxxxxxxxx',
'name' => 'Ecosport',
'access_token' => $access_token
));
echo '<pre>Post ID: ' . $ret_obj['id'] . '</pre>';
} catch(FacebookApiException $e) {
// If the user is logged out, you can have a
// user ID even though the access token is invalid.
// In this case, we'll get an exception, so we'll
// just ask the user to login again here.
$login_url = $facebook->getLoginUrl(array(
'scope' => 'publish_stream'
));
header("location:$login_url");
error_log($e->getType());
error_log($e->getMessage());
}
// Give the user a logout link
$id_articolo=$_GET['id_articolo'];
header("location:xxxxxxxxxx");
/*echo '<br /><a href="' . $facebook->getLogoutUrl() . '">logout</a>';*/
} else {
// No user, so print a link for the user to login
// To post to a user's wall, we need publish_stream permission
// We'll use the current URL as the redirect_uri, so we don't
// need to specify it here.
$login_url = $facebook->getLoginUrl(array('scope' => 'publish_stream'));
header("location:$login_url");
/*echo 'Please <a href="' . $login_url . '">login.</a>';*/
}
?>
Oviusly은 "XXXX"는 개인 정보 보호를 위해 사용됩니다
이
내가 페이스 북의 개발자로, 예로부터 크게 다르지 않다을 사용하는 코드입니다. 나는이 "$ facebook-> api ('/ $ page_id/feed', .......)에"$ facebook-> api ('/ me/feed', "......" "아무것도하지만. 내 팬 페이지에 나의 기사를 게시 할 수 없습니다. 당신이 날 도와 드릴까요? 가 대단히 감사합니다.
https://developers.facebook.com/docs/authentication/ – DMCS
DMCS의 페이지 로그인 섹션에서 팬 페이지에 사용자로 게시됩니다. 팬 페이지 *로 팬 페이지 *에 게시하는 방법을 알고 있습니까? * –
아니요, 위의 설명은 사용자로 스트림에 게시하지 않습니다. 페이지의 액세스 토큰을 사용하기 때문에 페이지로 게시됩니다. – DMCS