API错误代码:100 facebook OpenGraph


API Error code: 100 facebook OpenGraph

我刚刚开始在heroku上制作一个新的Facebook应用程序,我还没有做任何更改,但测试了一点功能,以习惯它的工作方式。一切都很好,直到我尝试"发送消息按钮",出现了一个对话框,其中包含以下错误日志:

An error occurred. Please try later
API Error Code: 100
API Error Description: Invalid parameter
Error Message: 'link' is invalid.

我看了一下相关的代码,我没有发现任何问题,但我是新手,所以也许你们中的任何一个都可以帮助我找出问题所在:

    $('#sendToFriends').click(function() {
          FB.ui(
            {
              method : 'send',
              link   : $(this).attr('data-url')
            },
            function (response) {
              // If response is null the user canceled the dialog
              if (response != null) {
                logResponse(response);
              }
            }
          );
        });

我认为$(this).attr('data-url');没有问题的原因是以下工作(贴墙按钮):

 $('#postToWall').click(function() {
      FB.ui(
        {
          method : 'feed',
          link   : $(this).attr('data-url')
        },
        function (response) {
          // If response is null the user canceled the dialog
          if (response != null) {
            logResponse(response);
          }
        }
      );
    });
  }

获取值的getUrl()函数为:

 public static function getUrl($path = '/') {
if (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1)
  || isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'
) {
  $protocol = 'https://';
}
else {
  $protocol = 'http://';
}
return $protocol . $_SERVER['HTTP_HOST'] . $path;

}

有谁能帮帮我吗?我在facebook开发者论坛和stackoverflow上搜索了一下,但是虽然错误代码是相同的,但错误信息是不同的。我认为这个问题来自facebook,因为feed方法有效,而send方法无效。这两个方法都在facebook sdk 中定义

注意:我正在使用最新的php sdk

我只在使用发送对话框时遇到了这个问题。feed发布工作得很好,这很奇怪。我在一个公共URL上使用动态查询字符串参数。

我通过强迫Facebook在之前刮掉URL 来修复这个问题,我试图通过FB UI发送对话框发送它。使用FB API命中graph.facebook.com, id参数中的URL和scrape参数设置为true

一样:

FB.api('https://graph.facebook.com/', 'post', {
    id: '[URL]',
    scrape: true
}, function(response) {
    FB.ui({
        method: 'send',
        name: '[name]',
        picture: '[Picture URL]',
        link: '[URL]',
        description: '[description]'
    });
});

对于同样的问题,我也给出了解决方案。