Jump to content

Facebook Connect -> Call back (close po-up) -> FB user info check -> setter quer


karubum

Recommended Posts

 

I am trying to write a program:

 

1) There is a Facebook Login button in index.php

When you click on it, the facebook connect will be appear with popup window

2) When you back callback url the pop-up  window will be closed.

3) Graph API will retrieve user info ( (email,user name, profile picture url,gender ), When these data come with jquery, all info will be send to server. Then we retrieve all these data to index2.php page. ( We will do these by JSON )

 

Shortly: Facebook Connect -> Call back (close po-up) -> FB user info check -> setter query -> getter query -> display data

 

I have index.php and able to get fb connect and get user data by Graph API. But I do not know how to pass data to server and retrive them to index2.php

 

 

 

 

Link to comment
Share on other sites

My index.php:

 

<?php

 

//uses the PHP SDK.  Download from https://github.com/facebook/php-sdk

//require 'facebook-platform/php/facebook.php';

require 'facebook-php-sdk/src/facebook.php';

 

$facebook = new Facebook(array(

  'appId'  => '289329761120769',

  'secret' => '9cad1979d8379605dc04e3c48bf7c18c'

));

 

$userId = $facebook->getUser();

 

?>

 

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">

  <body>

    <?php if ($userId) {

      $userInfo = $facebook->api('/' + $userId); ?>

      Welcome <?= $userInfo['name'] ?> </br>

 

      gender <?= $userInfo['gender'] ?> </br>

 

      username <?= $userInfo['username'] ?> </br>

 

      email <?= $userInfo['email'] ?> </br>

 

      website <?= $userInfo['website'] ?> </br>

 

    <img src="https://graph.facebook.com/<?= $userInfo['id'] ?>/picture"/> </br>

 

    <?php } else { ?>

    <div id="fb-root"></div>

 

      <div class="fb-login-button" scope="email,user_website">

        Login with Facebook

      </div>

    <!--fb:login-button" data-scope="email,user_website"></fb:login-button-->

 

    <?php } ?>

    <script>

      window.fbAsyncInit = function() {

        FB.init({

          appId      : '289329761120769',

          status    : true,

          cookie    : true,

          xfbml      : true,

          oauth      : true

        });

 

        FB.Event.subscribe('auth.login', function(response) {

          window.location.reload();

        });

      };

 

      (function(d){

        var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}

        js = d.createElement('script'); js.id = id; js.async = true;

        js.src = "//connect.facebook.net/en_US/all.js";

        d.getElementsByTagName('head')[0].appendChild(js);

      }(document));

    </script>

  </body>

</html>

 

 

 

 

I am trying to write a program:

 

1) There is a Facebook Login button in index.php

When you click on it, the facebook connect will be appear with popup window

2) When you back callback url the pop-up  window will be closed.

3) Graph API will retrieve user info ( (email,user name, profile picture url,gender ), When these data come with jquery, all info will be send to server. Then we retrieve all these data to index2.php page. ( We will do these by JSON )

 

Shortly: Facebook Connect -> Call back (close po-up) -> FB user info check -> setter query -> getter query -> display data

 

I have index.php and able to get fb connect and get user data by Graph API. But I do not know how to pass data to server and retrive them to index2.php

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.