如何使用新的Facebook API登录用户墙?

问题描述:

我已经存储了Facebook用户ID和Facebook的朋友ID。如何发布到用户的墙壁,而不登录到Facebook?

I have stored a Facebook user ID and a Facebook friend ID. How can I publish to the user's wall without logging into Facebook?

我已经使用了具有UID和target_id字段的旧Facebook API:

I have used the old Facebook API that has UID and target_id fields like this:

$param  =   array(
    'method'        =>  'stream.publish',
    'callback'      =>  '',
    'message'       =>  $row[message], 
    'attachment'    =>  json_encode($attachment), 
    'target_id'     =>  $row[friends_id],
    'uid'           =>  $row[sender_id],
    'privacy'       =>  ''
);

$result = $facebook->api($param);

这是否可能在新的Facebook PHP API?

Is this possible in new facebook PHP API?

$attachment = array('message' => $wall);
$facebook->api("/$target/feed/",'post', $attachment);

该应用程序具有墙壁发布权限。

The application has wall posting permissions.

只有当你有access_token与offline_permission被授予时,这是可能的。
如果你拥有它,然后在$附件中包含关键字access_token的标记

this is possible only if you have the access_token with offline_permission granted. if you have it, then include the token in $attachment with key "access_token"