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

1

0

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_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>
Sivas answered 30/9, 2011 at 10:33 Comment(1)
I found the problem, it's because of this in my .htaccess Do you know if there is a way to solve this problem without to comment out the upper code? RewriteCond %{HTTP_HOST} ^page\.de RewriteRule (.*) page.de/$1 [R=301,L]Sivas
M
0

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.

Masker answered 30/9, 2011 at 12:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.