Файл: servises/rate.php
Строк: 25
<?php
require'../shaxty.php'; // waphp.ru - закрытый клуб вап мастеров!
$align='left';
check_login();
$title='Курс валют';
include_once (H.'shaxty/head.php');
echo '<br />';
function get_content(){
$date = date("d/m/Y");
$link = "http://www.cbr.ru/scripts/XML_daily.asp?date_req=$date";
$fd = fopen($link, "r");
$text="";
if (!$fd){$text = false;}
else
{
while (!feof ($fd)) $text .= fgets($fd, 4096);
}
fclose ($fd);
return $text;
}
$content = get_content();
if($content){
$pattern = "#<Valute ID="([^"]+)[^>]+>[^>]+>([^<]+)[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>([^<]+)[^>]+>[^>]+>([^<]+)#i";
preg_match_all($pattern, $content, $out, PREG_SET_ORDER);
$dollar = "";
$euro = "";
foreach($out as $cur)
{
if($cur[2] == 840) $dollar = str_replace(",",".",$cur[4]);
if($cur[2] == 978) $euro = str_replace(",",".",$cur[4]);
}
echo 'Курс USD: '.$dollar.' руб.<br>Курс EUR: '.$euro.' руб.<br />';
} else echo 'Ошибка соединения, проверьте настройки!<br>';
echo '<br />';
echo $div1.'<a href="/servises/">Сервисы</a>'.$div9;
include_once (H.'shaxty/foot.php');
?>