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

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

问题描述

我正在使用Graph API开发一个Facebook应用程序。我以前使用不推荐的REST API开发了一个应用程序。



我遇到了一个问题,我无法检索用户的国家,只有他们的位置 - 这只是城市和州/地区组合格式(如休斯敦,得克萨斯州)。



如何使用Graph API检索用户的国家?如果这不是直接可能的话,可能有什么解决方法可以实现这一点?

解决方案

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



会给你:

 <?xml version =1.0encoding =UTF-8?> 
< fql_query_response xmlns =http://api.facebook.com/1.0/xmlns:xsi =http://www.w3.org/2001/XMLSchema-instancelist =true> ;
< user>
< current_location>
< city> Palo Alto< / city>
< state> California< / state>
< country>美国< / country>
< zip />
< id> 104022926303756< / id>
< name>加利福尼亚州帕洛阿尔托< / name>
< / current_location>
< / user>
< / fql_query_response>

因为我只能看到在fb上稳定的东西是FQL



使用 http://developers.facebook.com/docs/reference/ fql / 这里描述的表可以获取任何你需要的信息 - 图表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').

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?query=SELECT%20current_location%20FROM%20user%20WHERE%20uid=4&access_token=YOUR_ACCESS_TOKEN

will give you :

<?xml version="1.0" encoding="UTF-8"?> 
<fql_query_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" list="true"> 
  <user> 
    <current_location> 
      <city>Palo Alto</city> 
      <state>California</state> 
      <country>United States</country> 
      <zip/> 
      <id>104022926303756</id> 
      <name>Palo Alto, California</name> 
    </current_location> 
  </user> 
</fql_query_response> 

As i can see only thing which is stable on fb is FQL

Use http://developers.facebook.com/docs/reference/fql/ tables described here to get any info you need - graph api is not good yet

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

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