WordPress.org

Ready to get started?Download WordPress

Forums

International Websites (8 posts)

  1. seamusdoone2
    Member
    Posted 2 years ago #

    Hello,

    I am wondering if it is possible to create a site that depending on which country the visitor is accessing the site from a pages changes. So in other words I want there to be a different contact page depending on which country the website is being accessed from. Is this possible?

  2. avinash-woodun
    Member
    Posted 2 years ago #

    Hmm...if you are a newbie to wordpress..i guess it might be very difficult to do this..

    E.g

    you'll have to get the visitors ip...know from which country its from..then show your page according to his location...thats just an idea...

    btw have you ever used webmastertools...and y on earth do you need that anyway ?

  3. seamusdoone2
    Member
    Posted 2 years ago #

    Thank you for your response. I have not used web master tools. This is a good idea I need it to be automatic. I simply want my contact page to adjust to each location because it would be good for my site and goals.

  4. comediann
    Member
    Posted 2 years ago #

    I think the only way to do this is to code your site and filter the visitors by ip but i don't know how to do this or how safe it will be.

  5. seamusdoone2
    Member
    Posted 2 years ago #

    Thank you for responding. How would doing this be unsafe?

  6. comediann
    Member
    Posted 2 years ago #

    I don't know if the algorithms+ips are filtering correctly but i am not an expert on the subject + i don't have any experience in any of my sites.

  7. seamusdoone2
    Member
    Posted 2 years ago #

    Ok, well thank you for your response

  8. avinash-woodun
    Member
    Posted 2 years ago #

    function getIp() {
    
            $ip = $_SERVER['REMOTE_ADDR'];
    
            if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
    
                $ip = $_SERVER['HTTP_CLIENT_IP'];
    
            } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
    
                $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
    
            }
    
            return $ip;
    
        }
    echo "Remote addr: " . $_SERVER['REMOTE_ADDR']."<br/>";
    
    echo "X Forward: " . $_SERVER['HTTP_X_FORWARDED_FOR']."<br/>";
    
    echo "Clien IP: " . $_SERVER['HTTP_CLIENT_IP']."<br/>";

    You can use this to get the user ip..hopefully the good one

    Because the values of the X-Forwarded-For and Client-Ip are not reliable.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.