doulang5323 2012-03-31 16:44
浏览 42
已采纳

Facebook Open Graph Cache问题

I am creating an application that posts information to facebook when a user downloads a specific music album. I have the information parsing correctly. So if a user clicks the download for album 1, it will pull the information and submit to the open graph and show up on facebook, however when I click on the next album button, instead of parsing the information for album 2, it posts the information for album 1 again. I have tried fbrefresh=CAN_BE_ANYTHING but nothing seems to be working. Does anyone have insight to this?

Album 1 Meta Information parse.php?album=The%2520Pink%2520Slip

Album 2 Meta Information parse.php?album=The%2520Sexy%2520Single

Below is the code I am using:

<script type="text/javascript">
function postAlbum(album) {
    FB.api('/me/skibsthekid:listen_to?album=http://www.skibsthekid.com/parse.php?album=' + album, 'post',
    function(response) {
        if (!response) { 
            alert('Error Occurred I got no response with ' + $pageURL);
        } else if (response.error) {
            alert('Error Occurred '+ response.error);
        } else {
            alert('Post was successful! Action ID: ' + album);
        }
    });
}

Parse.php

<?php
    $title = $_GET['album'];
    foreach(glob('files/'. $title .'/*.jpg') as $art) {
        $art = str_replace(" ", "%20", $art);
        $image = 'http://skibsthekid.com/' . $art;
    }
?> 

<meta property="fb:app_id" content="185324271585974" />
<meta property="og:type" content="music.album" />
<meta property="og:title" content="<?php echo $title; ?>" />
<meta property="og:image" content="<?php echo $image; ?>" />
<meta property="og:url" content="http://www.skibsthekid.com/parse.php?album=<?php echo urlencode($title); ?>&fbrefresh=CAN_BE_ANYTHING" />
  • 写回答

2条回答 默认 最新

  • dssqq82402 2012-04-01 08:41
    关注

    You're not URL encoding the target URL when you post the request to Facebook's APIs. Anything after the 2nd ? is being ignored. You should instead do:

    var album_url = "http://www.skibsthekid.com/parse.php?album=" + album;
    FB.api('/me/skibsthekid:listen_to?album='+encodeURIComponent(album_url), 'post',...
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?