开发者

How to post to user's wall without logging in, using the new Facebook API?

开发者 https://www.devze.com 2023-03-30 08:29 出处:网络
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?

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?

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'       开发者_如何学C=>  ''
);

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

Is this possible in new facebook PHP API?

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

The application has wall posting permissions.


According to the docs it's also possible to post to a users feed without the "offline_permission" when the "publish_stream" permission is granted:

Comment about "publish_stream" taken from the docs: Enables your app to post content, comments, and likes to a user's stream and to the streams of the user's friends. With this permission, you can publish content to a user's feed at any time, without requiring offline_access.


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"

0

精彩评论

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