1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Check if someone Likes a specific Facebook Page

Discussion in 'Facebook API' started by NaSh123, Apr 10, 2011.

  1. #1
    I was wondering if there is a way, using the Graph API, to check if a specific user likes a specific Facebook Page.

    I know this can be done post-Authentication, but what about if I don't use Facebook Connect. Can I somehow check this?
     
    NaSh123, Apr 10, 2011 IP
  2. leunamer

    leunamer Peon

    Messages:
    65
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You can try the FQL query statement.

    $likeID = $facebook->api( array( 'method' => 'fql.query', 'query' => "SELECT source_id FROM connection WHERE source_id ='$user[id]' AND target_id = '$pageId'" ) );
    
    if($likeID){
        echo "User has liked the page";
    }else{
        echo "User hasn't liked the page yet";
    }
    
    Code (markup):
     
    leunamer, Apr 11, 2011 IP
  3. codeartist

    codeartist Peon

    Messages:
    96
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    codeartist, Apr 12, 2011 IP
  4. China Morden Lifestyle

    China Morden Lifestyle Peon

    Messages:
    181
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    learning here, but does it violate privacy.
     
    China Morden Lifestyle, Apr 26, 2011 IP
  5. kokarat

    kokarat Member

    Messages:
    34
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    38
    Digital Goods:
    1
    #5
    Thank you, helpful.
     
    kokarat, Apr 27, 2011 IP
  6. ploetzi

    ploetzi Member

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    31
    #6
    can i do the same with "Share"?
     
    ploetzi, Jun 25, 2011 IP
  7. rajnishalwys

    rajnishalwys Peon

    Messages:
    89
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I know this can be done post-Authentication, but what about if I don't use Facebook Connect.
     
    rajnishalwys, Jul 5, 2011 IP
  8. amkeabhi123

    amkeabhi123 Member

    Messages:
    219
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    28
    #8
    leaumer is right ,yes you can use it the fql query ,known the user who like it the facbook page
     
    amkeabhi123, Jul 16, 2011 IP
  9. moomycow

    moomycow Peon

    Messages:
    26
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Agreed, FQL.query is the way forward. Just make sure that you cache the result, otherwise you'll spend all day wasting API calls and, no doubt, having some failures.
     
    moomycow, Aug 3, 2011 IP