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.

get number of likes for a specific url

Discussion in 'Facebook API' started by Mak3MyDay, May 16, 2011.

  1. #1
    I am creating a website that lets user rate items by liking it, the like box has been implemented but I need to get the number of likes (as value, as int) for a specific URL because I will use the number in sorting the items based on their likes. It can be solved using Facebook's REST API but Facebook is on the process of deprecating the API. Your help would be very much appreciated
     
    Mak3MyDay, May 16, 2011 IP
  2. FBApps

    FBApps Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You can get the number of URL likes if you already added Open Graph Protocol tags, else you can get the number of shares and not likes

    This is an example :
    IMDB URL with a Facebook page :
    https://graph.facebook.com/?ids=http://www.imdb.com/title/tt0117500/
    Code (markup):
    To add and read about Open Graph Protocol :
    http://developers.facebook.com/docs/opengraph/
    Code (markup):
    Fetch the content of this URL to get your link likes :
    https://graph.facebook.com/?ids=http://yourlinkhere
    Code (markup):
    Under PHP use json_decode function to transform the result to PHP Array ;)
     
    FBApps, Jun 9, 2011 IP
  3. TechnoBombs

    TechnoBombs Member

    Messages:
    219
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    26
    #3
    @FBApps

    Really helped, Thanks for sharing this information.
     
    TechnoBombs, Jun 14, 2011 IP