开发者

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

开发者 https://www.devze.com 2023-04-10 06:00 出处:网络
I use the following Code on my Facebook page to check if user is FAN or NOT FAN. After this the users get different contents. It works fine but if I use Secure Browsing in Facebook I always see just:

I use the following Code on my Facebook page to check if user is FAN or NOT 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."

I'm using the SSL-Proxy from my webhoster. 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_requ开发者_高级运维est["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.
  • This JSON object contains the info if the current user is fan or not of this page.

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.

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)

To fix that, you'll need to buy and install an SSL certificate for your domain. Godaddy.com seems to be the cheapest offer.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号