ユーザーウォールにメッセージを公開できるFacebookアプリを使用しています 、 My Error Message :
Fatal error: Call to protected method BaseFacebook::getUserAccessToken() from context '' in /home/tillaf/public_html/facebook/login_facebook2.php on line 61
My file :
<?php
require_once("facebook.php");
@session_start();
$app_id = "********";
$app_secret = "*********";
$my_url = "http://t.****.net/**/login.php/";
///
$config = array();
$config['appId'] = '408682199198463';
$config['secret'] = 'd5b3c0ddfbd673dd94494f28524c1a84';
$config['fileUpload'] = false; // optional
$facebook = new Facebook($config);
///
////
////
$code = $_REQUEST["code"];
if(empty($code)) {
$_SESSION['state'] = md5(uniqid(rand(), TRUE)); // CSRF protection
$dialog_url = "https://www.facebook.com/dialog/oauth?client_id="
. $app_id . "&redirect_uri=" . urlencode($my_url) . "&state="
. $_SESSION['state'] . "&scope=user_birthday,read_stream,publish_stream,email,user_status,offline_access";
echo("<script> top.location.href='" . $dialog_url . "'</script>");
}
else{
$user_id = $facebook->getUser();
echo $user_id;
echo "<br/>";
////////// Get Access Token
/*
$app_token_url = "https://graph.facebook.com/oauth/access_token?"
. "client_id=" . $app_id
. "&client_secret=" . $app_secret
. "&grant_type=client_credentials";
$response = file_get_contents($app_token_url);
$params = null;
parse_str($response, $params);
echo("This app's access token is: " . $params['access_token']);
*/
///-------------
$user_access_token = $facebook->getUserAccessToken();
////////
////// Start publish on wall
//$facebook->getAccessTokenFromCode($_GET['code']);
$message='ssss';
$link='http://www.google.com';
$name='Samilox';
$caption='s';
$description='Descrption...';
$facebook->api("/me/feed",'POST',
array( 'access_token' =>$user_access_token,
'message' => 'Hello World!',
'link' => 'www.example.com'
)
);
///
}
?>
コードで申し訳ありません:)この質問を投稿する前に多くの解決策を試しているためです。
誰でも助けてくれますか?前もって感謝します