Kevin phytagoras
Kevin phytagoras

Reputation: 123

posting wall for facebook application error

i have a problem here and i will be happy if someone can answer it here it is i have a facebook application. I want that application to post wall to user who access it this is my code for posting wall in general

$facebook = new Facebook(array(
  'appId'  => '183548958372557',
  'secret' => '5243d800bb7ef208e39aec73c03fc33f',
  'cookie' => true,
));

// cek uda login pa lom, kalo lom redirect ke login url
$session = $facebook->getSession();
if (!$session) {
    $url = $facebook->getLoginUrl(array(
        'canvas' => 1,
        'fbconnect' => 0,
        'req_perms' =>  'email,publish_stream,status_update,user_birthday,user_location,user_work_history'
    //permission utk aplikasi --> penting
    ));

   echo "<script type='text/javascript'>top.location.href = '$url';</script>";
    die();
}
if($_POST['komen']!="") {
        try {
            $args =  array(
                        'message' => 'FoodSeeker: ' . $_POST['komen'],
                            'link' => 'http://apps.facebook.com/foodseeker',
                        'name' => 'Makan :p',
                        'picture' => 'http://freshread.files.wordpress.com/2010/12/angel.jpg',
                        'caption' => 'Dibuat oleh orang lapar dan untuk orang lapar'
);
            $result = $facebook->api('/me/feed', 'post', $args);
        } catch (FacebookApiException $e) {
            echo 'Error: ' . print_r($e, true);
        }
}
?>

the problem is, i can't get any post in my wall. While my other friends that use the same piece of code succeeds.

Upvotes: 1

Views: 383

Answers (1)

ShawnDaGeek
ShawnDaGeek

Reputation: 4150

Kevin

You can not prefill the message param according to Facebook TOS.
It looks as though you are using an older version of php-sdk.

A suggestion - Try using the new sdk, and setting your app setting to use OAUTH2.0

Upvotes: 1

Related Questions