I've setup a Facebook application and properly installed the Facebook Javascript SDK.
When visiting the site, user profile information is automatically displayed if they're logged into Facebook. (Exactly what I want).
I tried installing the PHP SDK earlier, however it requires the Connect and authorization, so once the page is loaded it will prompt me to Login - even though I'm logged into Facebook already. There are some other minor bugs I didn't like about the PHP SDK as well, so I've decided to ditch it and go with only the JS.
I can access the Profile name, email, gender, etc. and have those saved as separate JS variables as well as within separate
tags. The site is a WordPress site, and the goal is to automatically add anyone logged into Facebook as WordPress users.
wp_create_user ('$facebookusername', $'facebookemail', 'defaultpassword')
I've been stuck on this problem for awhile and have only come up with the following possibilities.... - Access the cookie from Facebook ??? - Does the JS SDK include a JSON object that could be converted to a PHP array?
Thanks everyone and this site is excellent!
You can get all information using js sdk and graph api and it will send the data in the json format.
Once you got the information just make ajax call to your php where it will get the input and do whatever you want.
And php has the 'json_decode' function which will convert the json data into an array..
To call the graph api using js sdk , use FB.api method
FB.api('/me', function(response) {
alert(response.name);
// here send a ajax request to a php script with the 'response' as data
});