如何用facebook api回复私信

时间:2014-02-27 06:56:42

标签: php facebook facebook-php-sdk

我设法在facebook页面上读取数据私信我。然后我想回复发件人但失败了。

我的应用权限:manage_pages, read_page_mailboxes

我的代码:

require '../src/facebook.php';
$facebook = new Facebook(array(
  'appId'  => '339554932xxxxxx',
  'secret' => 'zzz334534123xx',
));

$pages = $facebook->api('/me/accounts');

foreach ($pages['data'] as $page) {
        $page_access_token = $page['access_token'];
}

$MsgRep = "This is a reply message...";
$MID    = "m_mid.1393481292907:f67352f5dfd39b5e42";
$facebook->api('/'.$MID.'/messages', 'POST', array('message' =>$MsgRep, 'access_token' => $page_access_token));
echo "Message Sent";

结果:但我得到一个空白的屏幕。没有echo "Message Sent"

我的代码有问题吗?

由于

0 个答案:

没有答案