Dollar exchange rate display script

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Naughty
    Confirmed User
    • Jul 2001
    • 6487

    #1

    Dollar exchange rate display script

    Does anybody have, or know of a script that will allow me to display the dollar exchange rate as a variable?

    E.g. in php echo:
    Your price is based on $usdrate USD/Euro.
    seks.ai for sale - ping me
  • OzMan84
    Confirmed User
    • Nov 2003
    • 4740

    #2
    xe.com already does it for you
    XferClick - 300,000 UV daily and growing quickly. Majority US, EU, CA and AU traffic. Contact me for more information
    ICQ: 304568058

    Comment

    • k0nr4d
      Confirmed User
      • Aug 2006
      • 9231

      #3
      if you're querying another server every time the file is accessed its gonna slow shit down alot...
      Mechanical Bunny Media
      Mechbunny Tube Script | Mechbunny Webcam Aggregator Script | Custom Web Development

      Comment

      • Naughty
        Confirmed User
        • Jul 2001
        • 6487

        #4
        Originally posted by k0nr4d
        if you're querying another server every time the file is accessed its gonna slow shit down alot...
        I'm not. We just need it inside our admin area to update dbase records according to the newest rates. Once or twice weekly.
        seks.ai for sale - ping me

        Comment

        • Naughty
          Confirmed User
          • Jul 2001
          • 6487

          #5
          I know osCommerce has this thing that updates currencies in the admin panel, also through XE. I'll see if i can find that code
          seks.ai for sale - ping me

          Comment

          • Naughty
            Confirmed User
            • Jul 2001
            • 6487

            #6
            If anybody needs it, here goes....

            PHP Code:
            
            <?php
            
            
            function quote_xe_currency($to, $from = 'EUR') {
                $page = file('http://www.xe.net/ucc/convert.cgi?Amount=1&From=' . $from . '&To=' . $to);
            
                $match = array();
            
                preg_match('/[0-9.]+\s*' . $from . '\s*=\s*([0-9.]+)\s*' . $to . '/', implode('', $page), $match);
            
                if (sizeof($match) > 0) {
                  return $match[1];
                } else {
                  return false;
                }
              }
              
              print quote_xe_currency('USD', 'EUR');
            ?>
            seks.ai for sale - ping me

            Comment

            Working...