LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   [PHP] Currency Conversion (https://www.linuxquestions.org/questions/programming-9/%5Bphp%5D-currency-conversion-116303/)

pnh73 11-15-2003 09:03 AM

[PHP] Currency Conversion
 
Hi,

I need a system to automatically retrieve exchange rates that I can then use on my site to convert a value held in a database to that currency. Does any one have some code or source of code that I can use for this.

I tried systems that use SOAP but i kept getting errors and I dont have a clue what was going on!

I just want to create function that will grab the rates for USD, GBP and Euros and then convert using a single function, something like:

PHP Code:

function curConvert($amount$from$to) {

  if (!
strcmp($from,"USD") {
    
// Check $to
     //Convert from USD to $to and return ammount
   
}

  if (!
strcmp($from,"GBP") {
     
// Check $to
     //Convert from GBP to $to and return ammount
  
}

  if (!
strcmp($from,"EUR") {
     
// Check $to
     //Convert from EUR to $to and return ammount
  
}



TIA


All times are GMT -5. The time now is 05:58 PM.