How to program different welcome pages based on country IP?



How can I create different landing pages based on the country of the IP? For example, people from USA should get landing page 1 and people from Spain should get landing page 2.

Jonas L. Nilssen

Posted 2011-10-15T15:46:37.007

Reputation: 4



use being ip address, you will have not only country but also those field:

    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; }


Posted 2011-10-15T15:46:37.007

Reputation: 6 030


Try this php code

  <?php  $ip = $_SERVER['REMOTE_ADDR'];
    $json = file_get_contents("".$ip."&full=true");
    $json = json_decode($json,true);
    $timezone = $json[localTimeZone];?>


Posted 2011-10-15T15:46:37.007

Reputation: 616


Page tab is really just regular web page loaded in iframe within Facebook Page.

Default landing tab can only be defined to all non fan visitors of Facebook, but you can use country and locale for user part of signed_request passed to Page tab application canvas and provide different content for users from different locations/language-groups.

P.S. Mind that you cannot really ensure that country passed by Facebook is real user country, so use detection of country based on IP.

Juicy Scripter

Posted 2011-10-15T15:46:37.007

Reputation: 23 311