php - Uncaught OAuthException: (#200) Error on Facebook -
i want post on facebook wall using access token when use facebook login works when other user use, doesnt work.
for posting use account , authorize user login after getting access token using access token post on facebook wall.
it not working other user's login, please help.
code
$facebook = new facebook(array( 'appid' => $conf->get("facebook_api_id"), 'secret' => $conf->get("facebook_secret_id")) ); $user = $facebook->getuser(); $params = array( 'description' => $campaign['message'], 'message' => $campaign['message'], 'picture' => $campaign['image_path'], 'created_time' => strtotime($campaign['post_datetime'])); $facebook->setaccesstoken($campaign['access_token']); $uid = $facebook->getuser(); $facebook->api("/$user/feed", "post", $params);
by using app id/api key , app secret, want post on user's wall. posting on user's wall user have login box he/she login , got access token using access token post on specific time. using cron posting on user's wall using access token.
one thing i'm using app id/api key , app secret getting user's access token.
i got access token after getting access token want post , when hitting cron url gives me error fatal error: uncaught oauthexception: (#200) user hasn't authorized application perform action thrown in /home/xyz/public_html/xyyy/plugin/facebook/base_facebook.php on line 1271
please help, how can posting?
$facebook = new facebook(array( 'appid' => config::get('facebook_api_id'), 'secret' => config::get('facebook_secret_id'), 'scope'=>'create_note,manage_pages,photo_upload,publish_actions,publish_stream,share_item,status_update,video_upload' )); $user_id = $facebook->getuser(); if($user_id) { try { $accesstoken = $facebook->getaccesstoken(); $url = 'https://graph.facebook.com/oauth/access_token?client_id='.config::get('facebook_api_id').'&client_secret='.config::get('facebook_secret_id').'&grant_type=fb_exchange_token&fb_exchange_token='.$accesstoken; $ch = curl_init(); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_header, 0); curl_setopt($ch, curlopt_ssl_verifypeer, false); curl_setopt($ch, curlopt_ssl_verifyhost, 2); curl_setopt($ch, curlopt_returntransfer, 1); $response = curl_exec($ch); curl_close($ch); parse_str($response, $token_data); $access_token = $token_data['access_token'];
Comments
Post a Comment