Reputation: 1834
I want to know which city a visitor of my web page comes from in the following way:
1. If the visitor has a public Facebook profile,
then return her Facebook location.
2. Otherwise, return her location based on the IP address.
I know how to do (2). But is there a way to do (1)?
Upvotes: 0
Views: 1256
Reputation: 6529
You can use MaxMind API to get user's location based on his IP http://www.maxmind.com/app/ip-location
And to get user's location from his profile you can use Graph API https://developers.facebook.com/docs/reference/api/user/
Upvotes: 0
Reputation: 96363
Just question the Graph API for user.location – https://developers.facebook.com/docs/reference/api/user/
Upvotes: 0
Reputation: 43816
Without having them authorise your application, no.
Otherwise, a basic call to /USER_ID
in the API will return their locale
Upvotes: 1