【问题标题】:How to program different welcome pages based on country IP?如何根据国家 IP 编写不同的欢迎页面?
【发布时间】:2011-10-15 15:46:37
【问题描述】:

如何根据 IP 所在的国家/地区创建不同的登录页面?例如,来自美国的人应该获得登陆页面 1,来自西班牙的人应该获得登陆页面 2。

【问题讨论】:

    标签: facebook facebook-page


    【解决方案1】:

    使用http://freegeoip.net/json/64.34.119.1264.34.119.12作为IP地址,你不仅有国家,还有那些领域:

        public string ip { get; set; }
        public string country_code { get; set; }
        public string country_name { get; set; }
        public string region_code { get; set; }
        public string region_name { get; set; }
        public string metrocode { get; set; }
        public string city { get; set; }
        public string zipcode { get; set; }
        public string latitude { get; set; }
        public string longitude { get; set; }
    

    【讨论】:

      【解决方案2】:

      页面标签实际上只是在 Facebook 页面内的iframe 中加载的常规网页。

      默认登陆选项卡只能定义给 Facebook 的所有非粉丝访问者,但您可以将 countrylocale 用于 user 部分signed_request 传递给页面选项卡应用程序画布,并为来自不同位置/语言组的用户提供不同的内容。

      附: 请注意,您无法真正确保 Facebook 通过的国家/地区是真实的用户国家/地区,因此请使用基于 IP 的国家/地区检测。

      【讨论】:

        【解决方案3】:

        试试这个 php 代码

          <?php  $ip = $_SERVER['REMOTE_ADDR'];
            $json = file_get_contents("http://api.easyjquery.com/ips/?ip=".$ip."&full=true");
            $json = json_decode($json,true);
            $timezone = $json[localTimeZone];?>
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2012-01-12
          • 2015-07-10
          • 2012-09-04
          • 2015-03-28
          • 1970-01-01
          • 1970-01-01
          • 2012-04-07
          相关资源
          最近更新 更多