开发者

Facebook PHP SDK, post as user 1 while logged on user 2

开发者 https://www.devze.com 2023-01-31 06:58 出处:网络
My current code: (... variables setting, etc.) $facebook = new Facebook(array( \'appId\'=> $apiid, \'secret\' => $secret,

My current code:

(... variables setting, etc.)
$facebook = new Facebook(array(
'appId'  => $apiid,
'secret' => $secret,
'cookie' => true,
));

$session = $facebook->getSession();
$me = null;
if ($session)
{
(do some stuff on user's 1 page)
}
else
{
$login_url = $facebook->getLoginUrl();
header("Location: ".$login_url开发者_开发技巧);
exit;
}

I tried once, it worked. I was logged on user 1 to delete post ASAP. Then I've logged on user 2 account and tried this code. I was redirected to user's 2 facebook wall. What to do now? Do I need some extra permissions?


"Posting while user A" whilst logged in as User B kind of defeats the whole purpose of authentication. What you have described is likely impossible. You probably could post as User A on to User B's wall, but you cannot post as User B unless you are authenticated as them.

0

精彩评论

暂无评论...
验证码 换一张
取 消