Facebook请求2.0错误#200参数ID中的所有用户都必须接受TOS


Facebook Requests 2.0 Error #200 All users in param ids must have accepted TOS

我正在通过我的开发者测试帐户开发一个应用程序,我所做的只是试图向我的用户发布测试通知。我使用的是facebookrequests2.0文档,所以我的代码看起来像这样:

$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。有人知道为什么会发生这种情况吗?

我使用旋度而不是file_get_contents来求解它。file_get_contents曾经由于某种原因而抛出错误。

卷曲的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);

我知道我迟到了一点,但我希望这能帮助到别人。

您应该将allow_url_fopen设置为On