Facebook PHP SDK , Post to another users wall whats wrong? -
hello test code in order post facebook wall.if some_user me works , if user, doesn't ! can explain whats going wrong ? !!
my application in sandbox mode tried live , nothing changed !
<?php require_once 'src/facebook.php'; $msg = 'some message go here.'; $title = 'some title go here'; $uri = 'http://test.com'; $desc = 'some detailed message.'; $action_name = 'action link in footer of post'; $action_link = 'http://www.test.com'; $scope = "publish_stream,publish_actions"; $app_id = "xxx"; $app_secret = "xxxx"; $facebook = new facebook(array( 'appid' => $app_id, 'secret' => $app_secret, 'cookie' => true )); $user = $facebook->getuser(); if ($user) { try { $accesstoken = $facebook->getaccesstoken(); if (!empty( $accesstoken )) { $attachment = array( 'access_token' => $accesstoken, 'message' => $msg, 'name' => $title, 'link' => $uri, 'description' => $desc, 'picture'=>$pic, 'actions' => json_encode(array('name' => $action_name,'link' => $action_link,'scope' => $scope)) ); $status = $facebook->api("/some_user/feed", "post", $attachment); } } catch (facebookapiexception $e) { $user = null; } }else { header("location:{$facebook->getloginurl(array('scope' => 'publish_stream,publish_actions'))}"); }
Comments
Post a Comment