1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Need help (php code) on creating an fb fangate

Discussion in 'PHP & Perl' started by pasenseoso, Dec 14, 2012.

  1. pasenseoso

    pasenseoso Power Member

    Joined:
    Aug 19, 2011
    Messages:
    753
    Likes Received:
    135
    Occupation:
    hachetman
    Location:
    - - P I L I P I N A S - -
    Home Page:
    any one can help me check the problem with this? it does show the page but it cannot determine whether the page is already liked or not. it only shows the area for non-likers even if it is already liked.. need help.. if you got better scripts, may you share it if you don't mind..

    Code:
    <?php
    require 'facebook.php';
    $facebook = new Facebook(array(
    'appId' => '53095196139124',
    'secret' => '7e2204334894fd8369d070ecbcc5945c',
    'cookie' => true
    ));
    $signed_request = $facebook -> getSignedRequest();
    $like_status = $signed_request["page"]["liked"];
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>PAGE TITLE</title>
    <base target='_blank' />
    </head>
    <body>
    <?php if ($like_status == "1") 
    { ?>
    CONTENT FOR PAGE LIKERS
    <?php } else { ?>
    <iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.facebook.com%2Fb.o.f.g.i.n.f.o&send=false&layout=box_count&width=450&show_faces=true&font&colorscheme=light&action=like&height=90&appId=53095196139124" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:90px;" allowTransparency="true"></iframe>
    CONTENT FOR NON LIKERS
    <?php } ?>
    </body>
    </html>
    
    *app id and secret are samples only

    please help..
     
  2. johndoejohndoe

    johndoejohndoe Junior Member

    Joined:
    Feb 13, 2011
    Messages:
    177
    Likes Received:
    33
    Doe $like_status return anything? Echo it out to your screen before the if statement.
     
    • Thanks Thanks x 2
  3. pasenseoso

    pasenseoso Power Member

    Joined:
    Aug 19, 2011
    Messages:
    753
    Likes Received:
    135
    Occupation:
    hachetman
    Location:
    - - P I L I P I N A S - -
    Home Page:
    got it working. :)