Welcome Guest, Not a member yet? Register   Sign In
Codeigniter GeoLib
#1

Hello, I've created this Code-igniter library, might be helpfull for someone looking for such functionality. 

Codeigniter GeoLib

Github Repo

A CodeIgniter Geo library for getting 
  • IP location data
  • Currency conversion
  • User agent parsing.

Features

  1. Request API info from the geoPlugin API.
  2. When requesting data from remote API it uses both CURL and file_get_contents (whichever works on your host).
  3. It Provides a wrapper function around core CodeIgniter's user-agent data, so you got all the info in one array and don't have to memorize more stuff.
  4. Accurate, realtim-ish currency conversion using:
    • Yahoo Finance Query API.
    • Google's currency converter.
    • GeoPlugin currency data.
  5. It will first fetch Yahoo's API (since it's an official and efficient API, not based on a hack), then, if failed, it will fallback to Google's currency converter by extracting the data out of an HTML page, then if both failed (highly improbable it will fallback to GeoPlugin's currency data.
  6. You can pass either currency code (e.g. GBP) or country code (e.g. GB) or IP address (e.g. 1.2.3.4) to the currency converter method.
  7. You can pass null as the $to argument to the currency converter method, and it will take your IP and convert the currency from base to your local one. (base = $from).
  8. It has been designed to fit on almost every web host.
 

Github Repo
Reply
#2

Thanks for sharing. I noticed that you cache the stored queried information from the API's in a cookie. Cookies are stored client side and can be altered by a user. I believe it's a bad idea to place the currency rate in a place where a end user has the ability to change the rate. Imaging what some clever kid could do if you would use this in some ecommerce solution ;-)
Reply
#3

Spot on!! I've just fixed it..
Reply




Theme © iAndrew 2016 - Forum software by © MyBB