Php facebook api如何从用户位置获取lat/long
这里有一个讨论:但它没有显示如何获得它 我可以获得基本信息:Php facebook api如何从用户位置获取lat/long,php,facebook,api,location,Php,Facebook,Api,Location,这里有一个讨论:但它没有显示如何获得它 我可以获得基本信息: "location": { "id": "104146386288393", "name": "Newton, Massachusetts" }, 但是如何使用位置ID发出请求以获取 { "id": "104146386288393", "name": "Newton, Massachusetts", "picture": "http://external.ak.fbcdn.net/safe_image
"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
}
谢谢这是您可以做的:
- 向用户授权
user\u位置
- 向
/me?fields=location
- 对在
/me
我不知道如何从阵列中获取位置ID。。。如果我使用
$\u会话[“fb\u用户\u详细信息”][“位置”][“id”]
它不起作用。。。知道如何从阵列中获取我的位置ID吗?不知道您是如何实现这一点的。为什么要开会?为什么fb_用户_详细信息?只需对/me进行api调用,它就会出现在返回的结果中。只需更新,它不会出现在默认的/me结果中。您现在必须执行/me?字段=位置。此外,location现在还引用了一个id位于location.id的页面。然后,该页面有一个位置字段,该字段为位置类型,包含坐标等。
$user_profile = (new FacebookRequest($session, 'GET', '/me?fields=id, first_name, location'))->execute()->getGraphObject(GraphUser::className());