javascript - php (#200) The user hasn't authorized the application to perform this action -
what should fix problem code using facebook graph api require_once("src/facebook.php"); // set right path
$config = array(); $config['appid'] = '000000000000000'; $config['secret'] = '0000000000000000000000'; $config['fileupload'] = false; // optional // $config['publish_actions'] = true; $fb = new facebook($config); $params = array( // access token fan page "access_token" => "--------------------- access token --------------------------", "message" => "here blog post auto posting on facebook using php #php #facebook", "link" => "http://www.pontikis.net/blog/auto_post_on_facebook_with_php", "picture" => "http://i.imgur.com/lhkosih.png ", "name" => "how auto post on facebook php", "caption" => "www.pontikis.net", "description" => "automatically post on facebook php using facebook php sdk. how create facebook app. obtain , extend facebook access tokens. cron automation." ); try { // 466400200079875 facebook id of fan page https://www.facebook.com/pontikis.net $ret = $fb->api('/417648154966881/feed', 'post', $params); echo 'successfully posted facebook fan page'; } catch(exception $e) { echo $e->getmessage(); }
i have code request permission user... hope help.you have use old version facebook api, update preference
require 'src/facebook.php'; $config = array('appid' => '000000', 'secret' => '000000', ); $facebook = new facebook($config); try { $user_id = $facebook -> getuser(); if($user_id){ $user_profile = $facebook->api('/me','get'); }else { $login_url = $facebook -> getloginurl(array('canvas' => 1, 'fbconnect' => 0, 'scope' => 'user_about_me,user_activities,user_status,read_stream,publish_stream,photo_upload,status_update,publish_actions','redirect_uri' => 'https://yoururl.com/')); exit("<script>window.top.location.replace('$login_url');</script>"); } }catch(exception $e){ / exit("<script>location.reload();</script>"); }
update
url preference: https://developers.facebook.com/docs/reference/php/facebook-getloginurl/
Comments
Post a Comment