[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/admin/includes/functions/ -> localization.php (source)

   1  <?php
   2  /*

   3  $Id: localization.php 3 2006-05-27 04:59:07Z user $

   4  

   5    osCMax Power E-Commerce

   6    http://oscdox.com

   7  

   8    Copyright 2006 osCMax

   9  

  10    Released under the GNU General Public License

  11  */
  12  
  13    function quote_oanda_currency($code, $base = DEFAULT_CURRENCY) {
  14  
  15  // BOF: FIX OANDA.COM Forgen currency exhange

  16  //    $page = file('http://www.oanda.com/convert/fxdaily?value=1&redirected=1&exch=' . $code .  '&format=CSV&dest=Get+Table&sel_list=' . $base);

  17  //  ALTe START

  18     $alte_url = "http://www.oanda.com/convert/fxdaily";
  19     $alte_params = 'value=1&redirected=1&exch=' . $code .  '&format=CSV&dest=Get+Table&sel_list=' . $base;
  20     $alte_user_agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
  21  
  22     $alte_ch = curl_init();
  23     curl_setopt($alte_ch, CURLOPT_POST,1);
  24     curl_setopt($alte_ch, CURLOPT_POSTFIELDS,$alte_params);
  25     curl_setopt($alte_ch, CURLOPT_URL,$alte_url);
  26     curl_setopt($alte_ch, CURLOPT_SSL_VERIFYHOST, 2);
  27     curl_setopt($alte_ch, CURLOPT_USERAGENT, $alte_user_agent);
  28     curl_setopt($alte_ch, CURLOPT_RETURNTRANSFER,1);
  29     curl_setopt($alte_ch, CURLOPT_SSL_VERIFYPEER, FALSE);
  30  
  31     $alte_page=curl_exec ($alte_ch);
  32     curl_close ($alte_ch);
  33  
  34     $page = explode("\n",$alte_page);
  35  //  ALTe STOP    

  36  // EOF: FIX OANDA.COM Forgen currency exhange

  37  
  38      $match = array();
  39  
  40      preg_match('/(.+),(\w{3}),([0-9.]+),([0-9.]+)/i', implode('', $page), $match);
  41  
  42      if (sizeof($match) > 0) {
  43        return $match[3];
  44      } else {
  45        return false;
  46      }
  47    }
  48  
  49    function quote_xe_currency($to, $from = DEFAULT_CURRENCY) {
  50  // BOF: FIX XE.NET Forgen currency exhange

  51  //    $page = file('http://www.xe.net/ucc/convert.cgi?Amount=1&From=' . $from . '&To=' . $to);

  52  
  53  //  ALTe START

  54     $alte_url = "http://www.xe.net/ucc/convert.cgi";
  55     $alte_params = 'Amount=1&From=' . $from . '&To=' . $to;
  56     $alte_user_agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
  57  
  58     $alte_ch = curl_init();
  59     curl_setopt($alte_ch, CURLOPT_POST,1);
  60     curl_setopt($alte_ch, CURLOPT_POSTFIELDS,$alte_params);
  61     curl_setopt($alte_ch, CURLOPT_URL,$alte_url);
  62     curl_setopt($alte_ch, CURLOPT_SSL_VERIFYHOST, 2);
  63     curl_setopt($alte_ch, CURLOPT_USERAGENT, $alte_user_agent);
  64     curl_setopt($alte_ch, CURLOPT_RETURNTRANSFER,1);
  65     curl_setopt($alte_ch, CURLOPT_SSL_VERIFYPEER, FALSE);
  66  
  67     $alte_page=curl_exec ($alte_ch);
  68     curl_close ($alte_ch);
  69  
  70     $page = explode("\n",$alte_page);
  71  //  ALTe STOP    

  72  // EOF: FIX XE.NET Forgen currency exhange

  73      $match = array();
  74  
  75      preg_match('/[0-9.]+\s*' . $from . '\s*=\s*([0-9.]+)\s*' . $to . '/', implode('', $page), $match);
  76  
  77      if (sizeof($match) > 0) {
  78        return $match[1];
  79      } else {
  80        return false;
  81      }
  82    }
  83  ?>


Generated: Fri Jan 1 13:43:16 2010 Cross-referenced by PHPXref 0.7