这里有一个讨论:location (lat long) using facebook api但它并没有显示如何获得它......
我可以获得基本信息:
"location": {
"id": "104146386288393",
"name": "Newton, Massachusetts"
},
但如何使用位置ID提出请求
{
"id": "104146386288393",
"name": "Newton, Massachusetts",
"picture": "http://external.ak.fbcdn.net/safe_image.php?d=AQDygUYzFOcjhDoD&w=100&h=300&url=http\u00253A\u00252F\u00252Fupload.wikimedia.org\u00252Fwikipedia\u00252Fen\u00252Fe\u00252Fe6\u00252FNewton_City_Hall\u0025252C_Massachusetts.jpg&fallback=hub_city&prefix=s",
"link": "http://www.facebook.com/pages/Newton-Massachusetts/104146386288393",
"likes": 3741,
"category": "City",
"is_published": true,
"is_community_page": true,
"description": "<snipped data>",
"location": {
"latitude": 42.3369,
"longitude": -71.2097
},
"checkins": 310,
"talking_about_count": 8912
}
这是我的Facebook代码:
$user_profile = (new FacebookRequest($session, 'GET', '/me?fields=id, first_name, location'))->execute()->getGraphObject(GraphUser::className());
感谢
答案 0 :(得分:1)
这是你可以做的:
user_location
/me?fields=location
/me
...意思是,您只需要进行额外的API调用即可获得纬度/经度。
答案 1 :(得分:0)