currency converter

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    currency converter

    ok, i was coding an online orders interface that connects to paypal, but for some reason i couldn't send prices in certain currencies without getting an error message... so to work a way around this i modified some code I had to make the following function:
    PHP Code:
     function ZAR_2_USD($amount$from$to)
    {
    $amount urlencode($amount);
    $from_Currency urlencode($from);
    $to_Currency urlencode($to);
    $url "hl=en&q=$amount$from_Currency%3D%3F$to_Currency";
    $rawdata file_get_contents("http://google.com/ig/calculator?".$url);
    $data explode('"'$rawdata);
    $data explode(' '$data['3']);
    $var $data['0'];
    $xchanged round($var2);
    return 
    $xchanged;
    }
    //////////example////////////////
    //
    //$amount = $_POST['amount']; ie: 28.96
    //$from = $_POST['from']; ie: ZAR
    //$to = $_POST['to']; ie: USD

    // works like: echo "".ZAR_2_USD("28.96", "ZAR", "USD")."";
    //or better: echo "".ZAR_2_USD($amount, $from, $to).""; 

    ok, one problem i found is trying to convert bigger numbers, ie: over 100 pounds to ZAR etc doesn't calculate right... wondering if one of the better coders might have any ideas...
    C3 Themes: http://c3themes.wen.ru/index.html
    Find Files: http://mystarter.tk/?goto=X-search

    #2
    have you googled for already existing solutions?
    try this one:
    PHP Currency Converter via Google Finance
    Advertise your mobile site for FREE with AdTwirl

    Comment

    Working...
    X