karubum Posted February 2, 2012 Share Posted February 2, 2012 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 https://forums.phpfreaks.com/topic/256239-facebook-connect-call-back-close-po-up-fb-user-info-check-setter-quer/ Share on other sites More sharing options...
karubum Posted February 2, 2012 Author Share Posted February 2, 2012 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 https://forums.phpfreaks.com/topic/256239-facebook-connect-call-back-close-po-up-fb-user-info-check-setter-quer/#findComment-1313629 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.