简体   繁体   中英

Facebook post wall error?

You can see this: http://disavur.com/facebook this is my code:

$user = $facebook->getUser();

if($user) { 
    try {
       $statusUpdate = $facebook->api('/me/feed', 'post',
                 array('name'=>'My APP on Facebook','message'=> 'I am here working',
                 'privacy'=> array('value'=>'CUSTOM','friends'=>'SELF'),
                 'description'=>'testing my description',
                 'picture'=>'https://fbcdn-photos-a.akamaihd.net/mypicture.gif',
                 'caption'=>'apps.facebook.com/myapp','link'=>'http://apps.facebook.com/myapp'));
     } catch (FacebookApiException $e) {
          echo "error";;
    }
}
else
{

    echo "<a href='" . $facebook->getLoginUrl() . "'>login</a>";
}

This code returning "error". Where is the error?

Your app needs the "publish_stream" permission to be able to post on your wall. You request this permission by setting the req_perms parameter of $facebook->getLoginUrl

echo "<a href='" . $facebook->getLoginUrl(array('req_perms' => 'publish_stream')) . "'>login</a>";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM