I could get Facebook token from Android device and post the value to the web server.
When I used Facebook PHP SDK, it was easy to get facebook user information.
// Get User ID
$fb_id = $this->facebook->getUser();
// Get User Info
$user_profile = $this->facebook->api('/me');
Just this one line gave me all the information.
I have no idea how to get a user information by using only facebook token that I get from mobile.
// get mobile token
$fb_token = $this->input->post('fb_token');
$user_info = 'https://graph.facebook.com/me?access_token='.$fb_token;
Ok. so It looks like I get joson data if I use above url address.
How can I bring the array data into the server?
After the user has authenticated ( SSO ) you can simply use the Facebook object to make requests:
facebook.request("me", new RequestListener() {
@Override
public void onComplete(String response, Object state) {}
@Override
public void onIOException(IOException e, Object state) {}
@Override
public void onFileNotFoundException(FileNotFoundException e, Object state) {}
@Override
public void onMalformedURLException(MalformedURLException e, Object state) {}
@Override
public void onFacebookError(FacebookError e, Object state) {}
});
You can make synced requests: API Requests or asynced: Async API Requests
您只需要添加一行就可以了。
$userData = file_get_contents($user_info);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.