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.
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.
You can use my service, the http://ipinfo.io API to get the country code:
If you're interested in other details you could make a more generic function:
I've used the IP
8.8.8.8
in these examples, but if you want details for the user's IP just pass in$_SERVER['REMOTE_ADDR']
instead. More details are available at http://ipinfo.io/developersYou can get a mapping of country codes to currency codes from http://country.io/data/ and add that to your code. Here's a simple example:
Returns
string 'GBP'
.Many-many thanks to jmathai , ToonMariner , experimentX for precious advice.
But i have got the simple solution
An example based on ipdata.co, which gives you the currency symbol and code directly from an IP address.
The API also has 10 global endpoints each able to handle >10,000 calls per second!
Disclaimer
I created this service.
You should be able to use the MaxMind database for this.
http://www.maxmind.com/app/country
Perhaps this one should also help http://api.ip2.cc.nyud.net/?api=cname&ip=112.197.167.19
Also there's excellent question Good php API for extracting country code from IP? perhaps you can create a plugin for extracting the country code and currency code in zend framework.