Php Facebook Requests 2.0错误#200参数ID中的所有用户都必须接受TOS
我正在通过我的开发者测试帐户开发一个应用程序,我所做的只是试图向我的用户发布一个测试通知。我使用facebook requests 2.0文档进行此操作,因此我的代码如下所示:Php Facebook Requests 2.0错误#200参数ID中的所有用户都必须接受TOS,php,facebook,Php,Facebook,我正在通过我的开发者测试帐户开发一个应用程序,我所做的只是试图向我的用户发布一个测试通知。我使用facebook requests 2.0文档进行此操作,因此我的代码如下所示: $token_url = "https://graph.facebook.com/oauth/access_token?" . "client_id=" . $app_id . "&client_secret=" . $app_secret .
$token_url = "https://graph.facebook.com/oauth/access_token?" .
"client_id=" . $app_id .
"&client_secret=" . $app_secret .
"&grant_type=client_credentials";
$app_access_token = file_get_contents($token_url);
$user_id = $this->user->id;
$apprequest_url ="https://graph.facebook.com/" .
$user_id .
"/apprequests?message='testing notification'" .
"&" .
$app_access_token . "&method=post";
$result = file_get_contents($apprequest_url);
echo "Request id number: " . $result;
当我这样做时,我会在页面上看到一个错误,上面写着“无法打开流”,但是,当我将url复制并粘贴到地址栏时,我没有收到任何错误,也没有收到返回的请求id。有人知道为什么会发生这种情况吗?您应该设置为
On
我使用curl而不是file\u get\u contents
解决了这个问题<代码>文件\u获取\u内容用于出于某种原因引发错误
旋度的cpde为:
$ch = curl_init();
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_URL, $apprequest_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
$result = curl_exec($ch);
curl_close($ch);
我知道我有点晚了,但我希望这对别人有帮助