Well, that wasn't too hard to fix. After a small amount of Googling and reading I've discovered an alternative way of doing this. It works on my host... yours may or may not allow it, I don't know. It is dependent on the curl library being installed on your server.
Open /admin/includes/functions/localization.php and change it to this instead:
Code:
<?php
//
// +----------------------------------------------------------------------+
// |zen-cart Open Source E-commerce |
// +----------------------------------------------------------------------+
// | Copyright (c) 2003 The zen-cart developers |
// | |
// | http://www.zen-cart.com/index.php |
// | |
// | Portions Copyright (c) 2003 osCommerce |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the GPL license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available through the world-wide-web at the following url: |
// | http://www.zen-cart.com/license/2_0.txt. |
// | If you did not receive a copy of the zen-cart license and are unable |
// | to obtain it through the world-wide-web, please send a note to |
// | [email protected] so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// $Id: localization.php 290 2004-09-15 19:48:26Z wilt $
//
function quote_oanda_currency($code, $base = DEFAULT_CURRENCY) {
// $page = file('http://www.oanda.com/convert/fxdaily?value=1&redirected=1&exch=' . $code . '&format=CSV&dest=Get+Table&sel_list=' . $base);
$curl_handle = curl_init('http://www.oanda.com/convert/fxdaily?value=1&redirected=1&exch=' . $code . '&format=CSV&dest=Get+Table&sel_list=' . $base);
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT,1);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
$page = "";
$page = curl_exec($curl_handle);
curl_close($curl_handle);
$match = array();
// preg_match('/(.+),(\w{3}),([0-9.]+),([0-9.]+)/i', implode('', $page), $match);
preg_match('/(.+),(\w{3}),([0-9.]+),([0-9.]+)/i', $page, $match)
if (sizeof($match) > 0) {
return $match[3];
} else {
return false;
}
}
function quote_xe_currency($to, $from = DEFAULT_CURRENCY) {
// $page = file('http://www.xe.net/ucc/convert.cgi?Amount=1&From=' . $from . '&To=' . $to);
$curl_handle = curl_init('http://www.xe.net/ucc/convert.cgi?Amount=1&From=' . $from . '&To=' . $to);
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT,1);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
$page = "";
$page = curl_exec($curl_handle);
curl_close($curl_handle);
$match = array();
// preg_match('/[0-9.]+\s*' . $from . '\s*=\s*([0-9.]+)\s*' . $to . '/', implode('', $page), $match);
preg_match('/[0-9.]+\s*' . $from . '\s*=\s*([0-9.]+)\s*' . $to . '/', $page, $match);
if (sizeof($match) > 0) {
return $match[1];
} else {
return false;
}
}
?>
PLEASE NOTE!! This is for ZenCart 1.27d. I looked at the updated code for 1.3.5 and they already addressed this.
- Steven