www.webdeveloper.com
Results 1 to 2 of 2

Thread: Facebook get email and name

  1. #1
    Join Date
    Sep 2010
    Posts
    7

    Facebook get email and name

    Hello guys
    I'm making a facebook app and I made a great progress but stuck! I made an app in which it requires "Your basic info" and "Your e-mail address". If someone accepts the app use, I have the code that I can get
    • user_id
    • user locale
    • user country
    • and user oauth_token


    It seems that I don't really know how to retrieve the name (first_name and last name) and other details. YES I can see all my details in a link like below

    <a href="https://graph.facebook.com/USER_ID?access_token=THE_ACCESS_TOKEN_XXX">Graph</a><br/>

    but I don't know how to store in a php variable the values. Can anyone help??? The only things I want to do, is retrieve the name and email of users who accept the app (through the canvas page) and post somthing to their wall if they answer a few questions.

    Small paypal tip for the first one who helps!


    (edit: there are some examples that are using the php sdk - have tried all of them, but nothing works!!!! This also doesn't work: )
    Last edited by webdeveloper83; 04-09-2012 at 01:42 AM.

  2. #2
    Join Date
    Sep 2010
    Posts
    7
    Solution found. For those who understand facebook development, you can do this by using the json_decode

    $graph = json_decode(file_get_contents("https://graph.facebook.com/".$code));

    And then get values to php variables:

    $id = $graph->id;
    $name = $graph->first_name ;

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles