Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,150,755 members, 7,809,898 topics. Date: Friday, 26 April 2024 at 04:49 PM

World Currencies - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / World Currencies (2182 Views)

Receive and withdraw funds in more than 200 countries, in over 70 currencies! / Does Vogue Pay Now Accept Other Currencies? / Exchange Your E-currencies Webmasters! (2) (3) (4)

(1) (Reply) (Go Down)

World Currencies by kehers(m): 12:48pm On Dec 30, 2008
A current project requires a list of world currencies. I got the ISO-4217 codes from the link: http://fx.sauder.ubc.ca/currency_table.html and extracted the country name, currency name and symbol into a mysql table.
Attached is the mysql statements (the create table and inserts) in case it is needed by someone else - so u dont av to go through the stress of the extraction like I did.

Re: World Currencies by kehers(m): 12:55pm On Dec 30, 2008
For those interested in the extraction details, here is how I went about it. I simply checked the source code, copied out the table element containing the currencies (name, currency, symbol, code) and saved it in a file (currencies.txt).
I then used the following snippet to match, extract and insert into the mysql table.


<?php
mysql_connect("localhost", "root", ""wink;
mysql_select_db("tests"wink;
//
$content = file_get_contents('currency.txt');
preg_match_all("/<tr.*>(.*)<\/tr>/Usi", $content, $all);
$matches = $all[1];
foreach($matches as $match)
{
list($country, $currency, $iso, $symbol) = split('</td>', $match);
$country = trim(strip_tags($country));
$currency = trim(strip_tags($currency));
$iso = trim(strip_tags($iso));
$symbol = trim(strip_tags($symbol));
if(!empty($currency) && !empty($iso))
{
mysql_query("insert into `bills`.`currencies` (country, currency, symbol) values ('".addslashes($country)."', '".addslashes($currency)."', '$iso')"wink;
}
}
?>

It is a very rough piece of code - was so much in a hurry to do it better. Feel free to tweak in watever way. Whatever, this one altleast works.
Re: World Currencies by yawatide(f): 1:11pm On Dec 30, 2008
Lovely addition to the forum. These are the types of posts I look forward to seeing in 2009, as opposed to "chest thumping, do you know who i am?" posts.

Thanks brother.
Re: World Currencies by OmniPotens(m): 7:10pm On Dec 30, 2008
@yawa,

Thanks for hitting a mil on your posts wink


@kehers

Nice job bro. Keep it up!

Merry Xmas and Happy New Year in Advance!
Re: World Currencies by Afam4eva(m): 7:23pm On Dec 30, 2008
Thanks bro, it's people like you that God will bless in 2009.
U TOO MUCH JOO

(1) (Reply)

I Need Site Like Clubkonnect.com / Who Is The Best Adsense Earner In Nigeria / CLOSED

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 74
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.