如何获得Facebook用户的用户国家,州,城市 [英] How to get user country,state,city of Facebook user

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

问题描述

大家好,



有没有办法从Facebook获取用户的国家,州,城市信息。我对此进行了研究,但没有得到任何相关内容......

解决方案

试试这个

< script type =   text / javascript> 
window .fbAsyncInit = function (){
FB.init({
appId:' YOUR_APP_ID_HERE' // 应用程序ID
channelUrl:' http://localhost.com/channel.html' // 频道文件
状态: true // 检查登录状态
cookie: true // 启用cookie以允许服务器访问会话
o auth: true // 启用OAuth 2.0
xfbml: true // 解析XFBML
});
};
function (d){
var js,id = ' facebook-jssdk'; if (d.getElementById (id)){ return ;}
js = d.createElement(' script'); js.id = id; js.async = true ;
js.src = < span class =code-string> // connect.facebook.net/en_US/all.js;
d.getElementsByTagName (' head')[ 0 ] .appendChild(js);
}( document ));
< / script>

< h1>注册< / h1 >

< div style = float :left; margin-right:15px;>

< div class = FB-注册>
data-fields = ' [{name:name},
{名称:生日},
{名称:位置},//这将检索用户的位置
{name:gender},
{ name:email},
{name:username,description:Username,type:text},
{name:password }]'

data-redirect-uri = http://localhost.com /register.php\">


< / div > < / div >


Hi All,

Is there a way to get user country,state,city information from Facebook. I had a research on this but have not got anything related to this......

解决方案

try this

<script type="text/javascript">
                  window.fbAsyncInit = function() {
                    FB.init({
                      appId      : 'YOUR_APP_ID_HERE', // App ID
                      channelUrl : 'http://localhost.com/channel.html', // Channel File
                      status     : true, // check login status
                      cookie     : true, // enable cookies to allow the server to access the session
                      oauth      : true, // enable OAuth 2.0
                      xfbml      : true  // parse XFBML
                    });
                  };
                  (function(d){
                     var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
                     js = d.createElement('script'); js.id = id; js.async = true;
                     js.src = "//connect.facebook.net/en_US/all.js";
                     d.getElementsByTagName('head')[0].appendChild(js);
                   }(document));
                </script>
                 
                <h1>Registration</h1>
                 
                <div style="float: left; margin-right: 15px;">
                     
                    <div class="fb-registration">
                        data-fields='[{"name":"name"},
                                        {"name":"birthday"},
                                        {"name":"location"}, //this retrieves the location of the user
                                        {"name":"gender"},
                                        {"name":"email"},
                                        {"name":"username","description":"Username","type":"text"},
                                        {"name":"password"}]' 
                        data-redirect-uri="http://localhost.com/register.php">
                     

</div></div>


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

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