Follow us on...
Follow us on Twitter
Register
+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Member ciullaanthony's Avatar
    Join Date
    Jan 2012
    Location
    Arlington, Texas
    Posts
    91
    Feedback Score
    0

    Post Your Facebook Likes On Your Website

    Intro

    Have you ever wanted to post how many facebook likes your page has on your website? If so, now is your chance to learn so read carefully. In this tutorial you will make a document called "likes.php".

    Using Graph API

    Graph API is a simple API system that gives you information about a page or a document using JSON. You can access it by this link. http://www.graph.facebook.com/YOUR_USERNAME_HERE
    For example you can view Facebook.com's info here: Facebook

    The Code

    Insert this code into "likes.php" the page you made earlier in this tutorial.

    Code:
    <html>
    <head>
    <title>Likes Counter</title>
    </head>
    <body>
    <blockquote>
    <?php
    //Get content of the URL
    $input = file_get_contents("http://graph.facebook.com/facebook");
    //Decode the JSON content into class
    $output = json_decode($input);
    //Output number of likes
    echo $output->likes;
    ?>
    </blockquote>
    </body>
    </html>
    Change "facebook" with your page's id or username.
    Need Help? PM me for help.Thanks for visiting: http://www.webdevforum.com/

  2. #2
    Member Noble Genius's Avatar
    Join Date
    Jan 2012
    Location
    Northeast, U.S.A
    Posts
    42
    Feedback Score
    0
    Very nice tutorial. It shows a simple way of using Facebook's API to display likes. Some website owners pay developers to do these things despite it being quite easy.
    http://h5network.com/ - Design & Coding Forums

  3. #3
    Member ciullaanthony's Avatar
    Join Date
    Jan 2012
    Location
    Arlington, Texas
    Posts
    91
    Feedback Score
    0
    Ya, I like it. It is awesome how facebook made the API's.
    Need Help? PM me for help.Thanks for visiting: http://www.webdevforum.com/

  4. #4
    Member Noble Genius's Avatar
    Join Date
    Jan 2012
    Location
    Northeast, U.S.A
    Posts
    42
    Feedback Score
    0
    Quote Originally Posted by ciullaanthony View Post
    Ya, I like it. It is awesome how facebook made the API's.
    Every major social project has APIs? Twitter, Facebook... Heck, even youtube has a API on google code, the last time I checked. :P
    http://h5network.com/ - Design & Coding Forums

  5. #5
    Member ciullaanthony's Avatar
    Join Date
    Jan 2012
    Location
    Arlington, Texas
    Posts
    91
    Feedback Score
    0
    Heck, i didn't know that...
    Need Help? PM me for help.Thanks for visiting: http://www.webdevforum.com/

  6. #6
    Junior Member
    Join Date
    Jan 2012
    Posts
    21
    Feedback Score
    0
    I didn't know that either but I have been doing this for awhile without even knowing that.

  7. #7
    Member Noble Genius's Avatar
    Join Date
    Jan 2012
    Location
    Northeast, U.S.A
    Posts
    42
    Feedback Score
    0
    Seriously, I don't know if you guys are serious or this is sarcasm. :P How did you expect people to grab variable from twitter, facebook, or youtube, without API? O.o
    http://h5network.com/ - Design & Coding Forums

 

 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts