<?php
//Kursy walut//
// Konfiguracja //
DEFINE('_N_COLOR','#000000'); //kolor czcionki nagłówka
DEFINE('_W_COLOR','#000000'); //kolor czcionki wyników walut
// Konfiguracja //
// !!! NIE DOKONUJ ZMIAN W KODZIE PONIŻEJ TEGO KOMENTARZA !!! //
// Pocz±tek pobierania linku do kursu walut w formacie XML...
$a = "0";
$rest="
http://www.nbp.pl/kursy/kursya.html";
$link=file_get_contents($rest);
// Koniec pobierania linku do kursu walut w formacie XML
// Wycinanie linku
$link1 = strstr($link, 'xml');
$link2 = substr($link1, '0', '19');
$link = "
http://www.nbp.pl/Kursy/".$link2;
// Koniec. Link w zmiennej $link.
// Pobieranie arkusza XML
$rest=$link;
$buffer=file_get_contents($rest);
$pos = strpos($buffer, "<kod_waluty>USD</kod_waluty>")+28;
$kurs1=substr($buffer,$pos,28);
$kurs1=str_replace("kurs_sredni","",$kurs1);
$kurs1=str_replace("<","",$kurs1);
$kurs1=str_replace(">","",$kurs1);
$kurs1=str_replace("/","",$kurs1);
$pos = strpos($buffer, "<kod_waluty>EUR</kod_waluty>")+28;
$kurs2=substr($buffer,$pos,28);
$kurs2=str_replace("kurs_sredni","",$kurs2);
$kurs2=str_replace("<","",$kurs2);
$kurs2=str_replace(">","",$kurs2);
$kurs2=str_replace("/","",$kurs2);
$pos = strpos($buffer, "<kod_waluty>GBP</kod_waluty>")+28;
$kurs4=substr($buffer,$pos,28);
$kurs4=str_replace("kurs_sredni","",$kurs4);
$kurs4=str_replace("<","",$kurs4);
$kurs4=str_replace(">","",$kurs4);
$kurs4=str_replace("/","",$kurs4);
// Pobrano arkusz XML i wyniki do zmiennych.
// Wy¶wietlanie...
echo "<div style=\"width:auto; padding:5px 5px 5px 5px; background: #e7e6d5; font-weight:normal; font-size:11px; color:#807e69;\">¦rednie kursy walut z dnia ".$datak." wg NBP:</div>";
echo "<div style=\"width:auto; height: 26px; background: #f2f1e7; font-weight:normal; font-size:12px;\">
<div style=\"float:left; padding-left: 5px; color: #505050; font-weight: bold; line-height: 26px;\">USD</div>
<div style=\"float:right; padding-right: 5px;line-height: 26px; color: #333333; font-weight: bold; text-align: right;\">".$kurs1." PLN</div></div>";
echo "<div style=\"width:auto; height: 26px; background: #f6f6f0; font-weight:normal; font-size:12px;\">
<div style=\"float:left; padding-left: 5px; color: #505050; font-weight: bold; line-height: 26px;\">EUR</div>
<div style=\"float:right; padding-right: 5px;line-height: 26px; color: #333333; font-weight: bold; text-align: right;\">".$kurs2." PLN</div></div>";
echo "<div style=\"width:auto; height: 26px; background: #f2f1e7; font-weight:normal; font-size:12px;\">
<div style=\"float:left; padding-left: 5px; color: #505050; font-weight: bold; line-height: 26px;\">GBP</div>
<div style=\"float:right; padding-right: 5px;line-height: 26px; color: #333333; font-weight: bold; text-align: right;\">".$kurs4." PLN</div></div>";
?>