#include <Array.au3>
$aCurrency = _Get_Exchange_Rate('eng')
If @error Then
MsgBox(16, 'Error', 'Error')
Else
_ArrayDisplay($aCurrency, @MDAY & '.' & @MON & '.' & @YEAR)
EndIf
Func _Get_Exchange_Rate($s_Lang = 'rus', $s_Day = @MDAY, $s_Mon = @MON, $s_Year = @YEAR)
;$s_Lang = 'eng' - англ.язык, другое - русский.
Local $s_Sourse, $a_CurrencyTemp, $a_Currency[1][4], $i_Ubound, $s_Url, $i_Lang, _
$a_Title[5][2] = [['Цифр. код', 'Num сode'],['Букв. код', 'Char сode'], _
['Валюта', 'Currency'],['Единиц', 'Unit'],['Курс', 'Rate']]
Switch $s_Lang
Case 'eng'
$s_Url = 'http://www.cbr.ru/eng/currency_base/D_print.aspx?date_req=' & $s_Day & '.' & $s_Mon & '.' & $s_Year
$i_Lang = 1
Case Else
$s_Url = 'http://www.cbr.ru/currency_base/D_print.aspx?date_req=' & $s_Day & '.' & $s_Mon & '.' & $s_Year
$i_Lang = 0
EndSwitch
$s_Sourse = InetRead($s_Url, 17)
If @error Then Return SetError(1, 0, '')
$s_Sourse = BinaryToString($s_Sourse, 4)
$a_CurrencyTemp = StringRegExp($s_Sourse, '(?s)<tr><td align="right">(.*?)</td></tr>', 3)
If @error Then Return SetError(1, 0, '')
$i_Ubound = UBound($a_CurrencyTemp)
ReDim $a_Currency[$i_Ubound + 1][5]
For $i = 0 To 4
$a_Currency[0][$i] = $a_Title[$i][$i_Lang]
Next
For $i = 0 To $i_Ubound - 1
$a_Currency[$i + 1][0] = StringLeft($a_CurrencyTemp[$i], 3)
$a_Currency[$i + 1][1] = StringRegExpReplace($a_CurrencyTemp[$i], '(?s).*? (.*?)</td>?.*', '$1')
If @extended <> 1 Then Return SetError(1, 0, '')
$a_Currency[$i + 1][2] = StringRegExpReplace($a_CurrencyTemp[$i], '(?s).*?<td> (.*?)</td>?.*', '$1')
If @extended <> 1 Then Return SetError(1, 0, '')
$a_Currency[$i + 1][3] = StringRegExpReplace($a_CurrencyTemp[$i], '(?s).*?<td align="right">(.*?)</td>?.*', '$1')
If @extended <> 1 Then Return SetError(1, 0, '')
$a_Currency[$i + 1][4] = StringRegExpReplace($a_CurrencyTemp[$i], '(?s).*?' & $a_Currency[$i + 1][3] & '.*">(.*?)$', '$1')
If @extended <> 1 Then Return SetError(1, 0, '')
Next
Return SetError(0, 0, $a_Currency)
EndFunc ;==>_Get_Exchange_Rate