在来自 Facebook API 的状态更新中标记好友
2022-08-30 17:50:51
我最近遇到了这篇博客文章,它说可以从Facebook应用程序(=来自API)在状态更新中标记某人:
但是,它似乎不适合我。
它以三种不同的方式尝试了它:
$post = $facebook->api('/me/feed', 'post', array(
'access_token' => $session['access_token'],
'message' => 'Hello @[562372646:Lionel Cordier], how are you?'
));
或
$access_token = $session['access_token'];
$message = 'Hello @[562372646:Lionel Cordier], how are you?';
$curl_post = 'access_token='.$access_token.'&message='.$message;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://graph.facebook.com/me/feed');
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $curl_post);
$data = curl_exec($ch);
curl_close($ch);
或
$access_token = $session['access_token'];
$message = 'Hello @[562372646:Lionel Cordier], how are you?';
$curl_post = 'access_token='.$access_token.'&status='.$message;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.facebook.com/method/users.setStatus');
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $curl_post);
$data = curl_exec($ch);
curl_close($ch);
但没有任何效果。我的结果是“你好@[562372646:Lionel Cordier],你好吗?”在我的墙上。
但是,如果我直接在Facebook中输入“Hello @[562372646:Lionel Cordier],你好吗?”,它就能正常工作。
我做错了什么?