GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Dollar exchange rate display script (https://gfy.com/showthread.php?t=737074)

Naughty 05-28-2007 02:40 AM

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.

OzMan84 05-28-2007 02:43 AM

xe.com already does it for you

k0nr4d 05-28-2007 03:32 AM

if you're querying another server every time the file is accessed its gonna slow shit down alot...

Naughty 05-28-2007 04:22 AM

Quote:

Originally Posted by k0nr4d (Post 12499697)
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.

Naughty 05-28-2007 04:29 AM

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

Naughty 05-28-2007 04:38 AM

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');
?>



All times are GMT -7. The time now is 02:30 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123