为什么在开放图中读取操作不提交

时间:2012-07-16 10:59:52

标签: php javascript facebook-graph-api facebook-opengraph

我创建了一个应用程序,一个对象(文章)一个动作(读取),我想测试发布但我总是提交警告'出现错误'。为什么呢?

头部代码

<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# article: http://ogp.me/ns/fb/article#">
  <meta property="fb:app_id" content="xxxxxxxxxx" />
  <meta property="og:type" content="article" />
  <meta property="og:url" content="object_url" />
  <meta property="og:title" content="Tachnomo" />
  <meta property="og:description" content="Drive car" />
  <meta property="og:image" content="https://s-static.ak.fbcdn.net/images/devsite/attachment_blank.png" />

和javascript

<script type="text/javascript">
  function readnews()
  {
      FB.api(
        '/me/news.reads?article=object_url',
        'post',
        function(response) {
           if (!response || response.error) {
              alert('Error occured');
           } else {
              alert('Drive was successfully published with ID : ' + response.id);
           }
        });
  }
  </script>

1 个答案:

答案 0 :(得分:0)

“object_url”应该是一个编码的URL,而不是单词“object_url”。