Facebook integration in php website

by kaufenpreis Banned
2 replies
I would like know how to add facebook integration into php website??
Acutally i have integrate the facebook API into my php website but would like to know how to redirect the user to the facebook page after clicking the connect to facebook button inside my php website?? i.e. what kind of code i would have to write for the navigation to facebook page??
#facebook #integration #php #website
  • Profile picture of the author kilgore
    There are plenty of tutorials online on how to integrate PHP with Facebook, but I think the best place to start is Facebook itself. Their documentation can be a little iffy, but they do have a nice PHP SDK that can be found at https://developers.facebook.com/docs...ence/php/4.0.0

    A quick Google search brought up this tutorial which a quick glance reveals to be pretty good:
    Wrangling with the Facebook Graph API - Tuts+ Code Tutorial

    It'll take you through the steps from creating an App in Facebook to actually coding it (and by App, it can mean almost anything, from just downloading some FB data via their graph API, to integrating logins between your site and FB to creating a full-blown web application).
    {{ DiscussionBoard.errors[9286217].message }}
  • Profile picture of the author kingjpm
    Something I put together for testing the graph ..

    the PHP code tags are not working on the forum, so here it is ugly...

    function fetchData($user)
    {
    if(!empty($user))
    {
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "https://graph.facebook.com/".$user);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_REFERER, "http://www.jpmalloy.com"); // change to your URL
    $body = curl_exec($ch); // json string
    curl_close($ch);
    $data = json_decode($body, true);
    return $data;
    }
    }

    $user = ''; // Facebook username
    $data = fetchData($user);
    echo "https://graph.facebook.com/".$data['id']."/picture?type=large";

    Enjoy
    Signature
    RogueDen.com
    {{ DiscussionBoard.errors[9287114].message }}

Trending Topics