Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4534580
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T14:17:54+00:00 2026-05-21T14:17:54+00:00

I am new in zend Framework. And i want to get currency code, country

  • 0

I am new in zend Framework. And i want to get currency code, country code by the ip-address.

Can i have any example url?.

Please Help me…

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T14:17:55+00:00Added an answer on May 21, 2026 at 2:17 pm

    Many-many thanks to jmathai , ToonMariner , experimentX for precious advice.

    But i have got the simple solution

     public function getCountryIp()
    {
        $currency = new Zend_Currency();
        $countryCode = $this->getCountryFromIP();
        $currencyCode = $currency->getCurrencyList($countryCode);
        $localCurrency = $this->currency('USD',$currencyCode[0],50);
        $var['currencyCode'] = $currencyCode[0];
        $var['currency'] = $localCurrency;
        return $var;
    }
    
    
    
    //use to convert currency
    
    
    
    public function currency($from_Currency, $to_Currency, $amount)
     {
            $amount = urlencode($amount);
            $from_Currency = urlencode($from_Currency);
            $to_Currency = urlencode($to_Currency);
            $url = "http://www.google.com/ig/calculator?hl=en&q=$amount$from_Currency=?$to_Currency";
            $ch = curl_init();
            $timeout = 0;
            curl_setopt($ch, CURLOPT_URL, $url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)");
            curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
            $rawdata = curl_exec($ch);
            curl_close($ch);
            $data = explode('"', $rawdata);
            $data = explode(' ', $data['3']);
            $stripped = ereg_replace("[^A-Za-z0-9.\+]", "", $data['0']);//remove special char
            return round($stripped,3);
    //        $var = $data['0'];
    //        return $var;
    //        return round($var, 8);
        }
    
     //get ip-address and show country code
    
    
     public function getCountryFromIP()
     {
         $ip = $_SERVER['REMOTE_ADDR'];
    
        $country = exec("whois $ip  | grep -i country"); // Run a local whois and get the result back
        //$country = strtolower($country); // Make all text lower case so we can use str_replace happily
        // Clean up the results as some whois results come back with odd results, this should cater for most issues
        $country = str_replace("country:", "", "$country");
        $country = str_replace("Country:", "", "$country");
        $country = str_replace("Country :", "", "$country");
        $country = str_replace("country :", "", "$country");
        $country = str_replace("network:country-code:", "", "$country");
        $country = str_replace("network:Country-Code:", "", "$country");
        $country = str_replace("Network:Country-Code:", "", "$country");
        $country = str_replace("network:organization-", "", "$country");
        $country = str_replace("network:organization-usa", "us", "$country");
        $country = str_replace("network:country-code;i:us", "us", "$country");
        $country = str_replace("eu#countryisreallysomewhereinafricanregion", "af", "$country");
        $country = str_replace("", "", "$country");
        $country = str_replace("countryunderunadministration", "", "$country");
        $country = str_replace(" ", "", "$country");
    
        return $country;
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im new to Zend Framework, so asking a basic question. I want to get
I am new to zend framework. I have write this code to set cookie
im new in PHP and I want to know about PHP Zend Framework. What
I am pretty new to the zend framework and the JQuery helper. I have
I am a very new zend framework and phpunit test learner. I have a
I'm new to Zend Framework and not sure if this this posible. I want
I'm new to zend framework and I want to ask if is it possible
I want to upload an image in Zend-framework. In Application_Form_Test.php I write following code....
Hy Somebody! I have a question I want to solve in Zend Framework. The
I am new to Zend Framework and OO design patterns. I have three tables:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.