Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions Payserv/GoogleFinance/Model/Google.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
class Payserv_GoogleFinance_Model_Google extends Mage_Directory_Model_Currency_Import_Abstract
{
//protected $_url = 'http://quote.yahoo.com/d/quotes.csv?s==X&f=l1&e=.csv';
protected $_url = 'http://www.google.com/finance/converter?a=1&from={{CURRENCY_FROM}}&to={{CURRENCY_TO}}';
//protected $_url = 'http://www.google.com/finance/converter?a=1&from={{CURRENCY_FROM}}&to={{CURRENCY_TO}}';
protected $_url = 'https://www.xe.com/currencyconverter/convert/?Amount=1&From={{CURRENCY_FROM}}&To={{CURRENCY_TO}}';
protected $_messages = array();

protected function _convert($currencyFrom, $currencyTo, $retry=0)
Expand All @@ -51,7 +52,8 @@ protected function _convert($currencyFrom, $currencyTo, $retry=0)
$res = curl_exec($ch);
curl_close($ch);

if(preg_match("'<span class=bld>([0-9\.]+)\s\w+</span>'", $res, $m))
if(preg_match("/<span class='uccResultAmount'>([0-9.]*)<\/span>/", $res, $m))
//(preg_match("'<span class=bld>([0-9\.]+)\s\w+</span>'", $res, $m))
$exchange_rate = $m[1];

if( !$exchange_rate ) {
Expand All @@ -69,4 +71,4 @@ protected function _convert($currencyFrom, $currencyTo, $retry=0)
}
}
}
}
}