Facebook og数据未更新 [英] facebook og data not updating

查看:95
本文介绍了Facebook og数据未更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了一个带有订阅的Facebook应用.

当用户打开应用程序时,会有一个名为"SUBSCRIBE"的按钮.单击时,将调用javascript函数completePayment().出现带有订阅的Facebook弹出窗口.但是,这是一个大问题.如果我更改og:image URL,并将价格设置为10.00 USD,将计费周期设置为1个月,然后将该文件上传到服务器,然后单击SUBSCRIBE按钮,我仍然可以看到订阅页面显示5.00美元/周,图像为空白.

即使我从

这是" https://www.mydomain.com/_product.php "页面:

<html>
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# fbpayment: http://ogp.me/ns/fb/fbpayment#">        
    <meta property="og:title" content="********* Subscription" />
    <meta property="og:image" content="https://s-static.ak.fbcdn.net/images/devsite/attachment_blank.png" />
    <meta property="og:description" content="****** Subscription" />
    <meta property="fbpayment:price" content="5.00 USD" />
    <meta property="fbpayment:alternate_price" content="3.49 EUR" />
    <meta property="fbpayment:alternate_price" content="3.49 GBP" />
    <meta property="fbpayment:trial_duration" content="7 days" />
    <meta property="fbpayment:billing_period" content="1 week" />
    <meta property="fb:app_id" content="2*************6" />
    <meta property="og:url" content="https://www.mydomain.com/_product.php" />
    <meta property="og:type" content="fbpayment:subscription" />
</html>

解决方案

facebook页面上有一个关于共享内容的缓存(如果不是半永久性的话): 可能有3种选择:

1)尝试清除以下页面上的页面缓存: https://developers.facebook.com/tools/调试 但是下次共享页面时您会遇到同样的问题

2)在您的网址中添加动态参数( https://www.mydomain. com/_product.php?q = 123 ),那么您将拥有与此网址相关联的唯一值,但是您需要使用参数php_get为该特定网址设置og.如果您没有什么价值,则可以手动进行设置;另一方面,如果您有更多价值或动态价值,则需要一个数据库表来存储带有链接URL和相关og的数据,并在php_get

3)通过重新抓取以编程方式清除缓存.请参阅: https://developers.facebook.com/docs/payments /product?locale = zh_CN#scraping-object

我在网站上做过类似的事情,但只是使用随机生成的值: http://www.paris-web.it/test.html

I have created a facebook app with subscription.

When the user opens the app, there is a button called "SUBSCRIBE". When it is clicked, the javascript function completePayment(), is called. The facebook popup with subscribe appears. However, there is a big problem. If I change the og:image URL and set the price to let's say 10.00 USD and the billing period to 1 month and I upload the file to the server and then I click on the SUBSCRIBE button, I can still see the subscription page saying 5.00 USD/week and the image is blank.

It's like everything remained the same way that it was when I first set the data, even though I updated all the data from https://www.mydomain.com/_product.php , with the new values. I even logged out and relogged in, and still no changes are reflected.

I even emptied the _product.php page and uploaded it to the server and the subscription still works and shows 5.00 USD/week and the image is blank.

Any ideas on how to fix this?

I have this code on the main page:

<a href="#" onclick="completePayment()"> 
    <img src="https://www.**********.com/subscribe.png" alt="Subscribe" title="Subscribe" style="vertical-align: top"/>
    <script src="https://connect.facebook.net/en_US/all.js"></script>
    <script type="text/javascript">
     FB.init({
      appId:'2***********6',
      cookie:true,
      status:true,
      xfbml:true
     });
      function completePayment(){
         var obj = {
        method: 'pay',
        action: 'create_subscription',
        product: 'https://www.mydomain.com/_product.php'
     };
    FB.ui(obj);
    }
    </script>
    </a>

This is the HTML code from the 'https://www.mydomain.com/_product.php' page:

<html>
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# fbpayment: http://ogp.me/ns/fb/fbpayment#">        
    <meta property="og:title" content="********* Subscription" />
    <meta property="og:image" content="https://s-static.ak.fbcdn.net/images/devsite/attachment_blank.png" />
    <meta property="og:description" content="****** Subscription" />
    <meta property="fbpayment:price" content="5.00 USD" />
    <meta property="fbpayment:alternate_price" content="3.49 EUR" />
    <meta property="fbpayment:alternate_price" content="3.49 GBP" />
    <meta property="fbpayment:trial_duration" content="7 days" />
    <meta property="fbpayment:billing_period" content="1 week" />
    <meta property="fb:app_id" content="2*************6" />
    <meta property="og:url" content="https://www.mydomain.com/_product.php" />
    <meta property="og:type" content="fbpayment:subscription" />
</html>

解决方案

The facebook page have a looong if not semi permanent cache about share content: 3 options are possible:

1) try to clear the page cache on: https://developers.facebook.com/tools/debug but you will fall in the same problem next time you share the page

2) add a dynamic parameter to your url (https://www.mydomain.com/_product.php?q=123), than you will have a unique value associated with this url, but you need to set the og for this specific url with a php_get on the parameter. If you have few value you can make it manually, on the other hands if you have more value or dynamic value you need a DB table to store the data with the link url and the associated og and get the value in the php_get

3) Clear the cache programatically by re-scraping it. See: https://developers.facebook.com/docs/payments/product?locale=en_GB#scraping-object

I've done somthing similar on my site but only with random generated value: http://www.paris-web.it/test.html

这篇关于Facebook og数据未更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆