简体   繁体   English

安全浏览不会在Facebook页面上为粉丝/非粉丝显示不同的内容

[英]Secure Browsing don't show different content for Fans/Non-Fans on a Facebook Page

I use the following Code on my Facebook page to check if user is FAN or NOT FAN. 我在我的Facebook页面上使用以下代码检查用户是否为FAN。 After this the users get different contents. 此后,用户将获得不同的内容。 It works fine but if I use Secure Browsing in Facebook I always see just: "You don't like this page yet." 它工作正常,但是如果我在Facebook中使用“ 安全浏览” ,我只会看到:“您现在还不喜欢此页面。”

I'm using the SSL-Proxy from my webhoster. 我正在使用来自Webhoster的SSL代理。 Do you've any idea why it doesn't works while secure browsing? 您是否知道为什么安全浏览时不起作用?

<?php
require_once 'facebook-php-sdk/src/facebook.php';

// Create our Application instance.
$facebook = new Facebook(array(
  'appId' => 'X',
  'secret' => 'X',
  'cookie' => true,
));

$signed_request = $facebook->getSignedRequest();
$like_status = $signed_request["page"]["liked"];
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="https://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>zukundo</title>
<link rel="stylesheet" href="css/blueprint/screen.css" type="text/css" media="screen, projection">
</head>

<body>
<?php 
if ($like_status) {
    echo "You like this page.";
} else {
    echo "You like this page not yet.";
  }
?>

</body>
</html>

I assume your application is a tab application, not a canvas one. 我假设您的应用程序是标签应用程序,而不是画布应用程序。

Here is how it works: 下面是它的工作原理:

  • The facebook page will load your application in a iframe, with a POST parameter "signed_request" that contains an encrypted JSON Object, which is decrypted using your app secret. Facebook页面将使用POST参数“ signed_request”在iframe中加载您的应用程序,其中包含加密的JSON对象,该JSON对象使用您的应用程序密码进行解密。
  • This JSON object contains the info if the current user is fan or not of this page. 如果当前用户不是此页面的粉丝,则此JSON对象包含信息。

If you're using an SSL proxy, it's possible that this proxy is receiving the POST parameter, but not propagating it to your application afterward. 如果您使用的是SSL代理,则该代理可能正在接收POST参数,但此后未将其传播到您的应用程序中。

In this case, your app wouldn't be able to receive any info from facebook, so you wouldn't be able to know if the user is fan or not (at least, not until he has granted you the permission to access his data, so you could check using the API) 在这种情况下,您的应用程序将无法从Facebook接收任何信息,因此您将无法知道用户是否支持该用户(至少直到用户授予您访问其数据的权限后,该用户才能这样做) ,因此您可以使用API​​进行检查)

To fix that, you'll need to buy and install an SSL certificate for your domain. 要解决此问题,您需要为您的域购买并安装SSL证书。 Godaddy.com seems to be the cheapest offer. Godaddy.com似乎是最便宜的报价。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM