Facebook Graph API - 如何获取用户国家? [英] Facebook Graph API - how to get user country?

查看:29
本文介绍了Facebook Graph API - 如何获取用户国家?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用他们的 Graph API 开发 Facebook 应用程序.我以前使用过时的 REST API 开发了一个应用程序.

I'm developing a Facebook application using their Graph API. I have previously developed an app using the deprecated REST API.

我遇到了一个问题,我无法检索用户的国家/地区,只能检索他们的位置"——这只是城市和州/地区的组合格式(例如德克萨斯州休斯顿").

I've come across a problem in that I can't retrieve the user's country, only their 'location' - which is just the city and state / region in a combined format (such as 'Houston, Texas').

如何使用 Graph API 检索用户所在的国家/地区?如果这不是直接可能的,那么可能有哪些解决方法来实现这一目标?

How is it possible to retrieve the user's country using the Graph API? If this isn't directly possible, what workarounds might there be to achieve this?

推荐答案

https://api.facebook.com/method/fql.query?format=json&query=SELECT%20current_location%20FROM%20user%20WHERE%20uid=4&access_token=

[
  {
    "current_location": {
      "city": "Palo Alto",
      "state": "California",
      "country": "United States",
      "zip": "",
      "latitude": 37.4441,
      "longitude": -122.163,
      "id": 104022926303756,
      "name": "Palo Alto, California"
    }
  }
]

FQL 文档

这篇关于Facebook Graph API - 如何获取用户国家?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆