我在Facebook上分享网站意味着我的Facebook墙不显示贴墙。你能建议我解决吗?
$fb_access_token = $this->session->get("fb_access_token");
$fb_user_id=$this->session->get("fb_user_id");
$redirect_url = URL_BASE."socialnetwork/facebookshare";
if(!$fb_access_token){
$code=arr::get($_REQUEST,'code');
if($code){
$token_url = "https://graph.facebook.com/oauth/access_token?client_id=".FB_APP_ID."&redirect_uri=".$redirect_url."&client_secret=".FB_APP_SECRET."&code=".$code;
$access_token = $this->curl_function($token_url);
$FBtoken = str_replace("access_token=","", $access_token);
$FBtoken = explode("&expires=", $FBtoken);
if(isset($FBtoken[0])){
$profile_data_url = "https://graph.facebook.com/me?access_token=".$FBtoken[0];
$Profile_data = json_decode($this->curl_function($profile_data_url));
if(isset($Profile_data->error)){
echo $this->Lang["PROB_FB_CONNECT"]; exit;
}
else{
$this->session->set("fb_access_token",$FBtoken[0]);
$this->session->set("fb_user_id",$Profile_data->id);
return $FBtoken[0].'|'.$Profile_data->id;
}
}
else{
Message::error(__('sorry_not_shared_accesstoken'));
$this->url->redirect('users/dashboard');
}
Message::error(__('sorry_not_shared_accesstoken'));
$this->url->redirect('users/dashboard');
}
else{
$this->request->redirect("https://www.facebook.com/dialog/oauth?client_id=".FB_APP_ID."&redirect_uri=".urlencode($redirect_url)."&scope=email,publish_actions");
die();
}
}
else{
$fb_access_token = $this->session->get("fb_access_token");
$fb_user_id=$this->session->get("fb_user_id");
return $fb_access_token.'|'.$fb_user_id;
}
这是我的共享代码
$post_arg = array("access_token" => $fb_access_token, 'message'=>'Test Message', "id" => $fb_user_id,'description' =>$this->metadescription,'site_link'=>URL_BASE,'caption' =>$this->title,'picture' =>$logo, "method" => "post");
if($fb_access_token=="" || $fb_user_id==""){
Message::error(__('sorry_not_shared_accesstoken'));
$this->url->redirect('users/dashboard');
}
$share=$this->fb_curl_function("https://graph.facebook.com/feed", "POST", $post_arg);