live currency exchange rates widget on page?

Discussion in 'HTML & Website Design' started by panxzz, Jan 25, 2010.

  1. #1
    i have a client that wants to fill some space on their web page with the conversions of one USD to a couple of other currencies, and wants the rates to be updated frequently.

    is there some site that offers this type of widget i can just throw on the page?
     
    panxzz, Jan 25, 2010 IP
  2. wineri.es

    wineri.es Peon

    Messages:
    30
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    yes... Try to search on google.com/ig
     
    wineri.es, Jan 26, 2010 IP
  3. panxzz

    panxzz Peon

    Messages:
    20
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thanks so much! you saved me a load of hours in front of this computer screen
     
    panxzz, Jan 26, 2010 IP
  4. jobykjoseph10

    jobykjoseph10 Well-Known Member

    Messages:
    194
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    130
    #4
    customise and use this code so that no other brands will appear in your site.

    <?php

    function Google_Currency($amount, $from, $to)
    {
    $matches = array();

    if (preg_match('~<b>.+? = (.+?)</b></h2>~', file_get_contents('http://www.google.com/search?q=' . urlencode(floatval($amount) . ' ' . strtoupper($from) . ' to ' . strtoupper($to))), $matches) > 0)
    {
    if (array_key_exists(1, $matches) === true)
    {
    return floatval($matches[1]);
    }
    }

    return false;
    }
    echo Google_Currency(1, 'USD', 'FJD'); // 0.768816791
    echo Google_Currency(1, 'USD', 'GBP'); // 0.686671702
    echo Google_Currency(1, 'EUR', 'USD'); // 1.3007
    echo Google_Currency(1, 'EUR', 'GBP'); // 0.893153883
    echo Google_Currency(1, 'GBP', 'USD'); // 1.4563
    echo Google_Currency(1, 'GBP', 'EUR'); // 1.11962789
    ?>
     
    jobykjoseph10, Jan 26, 2010 IP