[Linux-programlama] Php de döviz bilgileri

---------

New Message Reply About this list Date view Thread view Subject view Author view Attachment view

From: m.surucu@pusulayazilim.com
Date: Tue 15 Feb 2005 - 12:02:23 EET


TCMB den döviz bilgileri bu kodla almaya çalışıyom. sitede ytl olarak
yayınlandığından sadece 1 yazıyor. bu nu ytl cinsinden nasıl
yazdırabilirim.

<?php

$dovizbugun = @file("http://www.tcmb.gov.tr/kurlar/today.html");

if($dovizbugun)
{
$dovizbugun = implode("", $dovizbugun);
$dvzbugun = ereg_replace("\r", "", $dovizbugun);

$Dolarkos = strpos($dovizbugun, "ABD DOLARI");
$Eurokos = strpos($dovizbugun, "EURO");

$dolarbugun = trim(substr($dovizbugun, $Dolarkos+14, 40));
$eurobugun = trim(substr($dovizbugun, $Eurokos+20, 40));

while ( ereg( "[ ]{2,}", $dolarbugun)>0 )
$dolarbugun = ereg_replace( "[ ]{2,}", " ", $dolarbugun );
$eurobugun = ereg_replace( "[ ]{2,}", " ", $eurobugun );

         // while ( strpos($dovizbugun, " ")>0 )
            // $dovizbugun = ereg_replace(" ", " ", $dovizbugun);

$dolarbugun = explode( " ", $dolarbugun );
$eurobugun = explode( " ", $eurobugun );

$Dolar = array ( number_format((double)ereg_replace( ",", "",
$dolarbugun[0] ), 0, ",", "."), number_format((double)ereg_replace( ",",
"", $dolarbugun[1] ), 0, ",", "."));
$Euro = array ( number_format((double)ereg_replace( ",", "", $eurobugun[0]
), 0, ",", "."), number_format((double)ereg_replace( ",", "", $eurobugun[1]
), 0, ",", "."));

$content = "<table border=\"0\" width=\"95%\" cellspacing=\"1\"
cellpadding=\"0\">";
$content .= "<tr>";
$content .= "<td width=\"40%\" >USD Alış</td>";
$content .= "<td width=\"60%\" align=\"right\" ><b>$Dolar[0] TL</td>";
$content .= "</tr>";
$content .= "<tr>";
$content .= "<td width=\"40%\">USD Satış</td>";
$content .= "<td align=\"right\" ><b>$Dolar[1] TL</td>";
$content .= "</tr>";
$content .= "<tr>";
$content .= "<td width=\"40%\" >EURO Alış</td>";
$content .= "<td width=\"60%\" align=\"right\" ><b>$Euro[0] TL</td>";
$content .= "</tr>";
$content .= "<tr>";
$content .= "<td width=\"40%\" >EURO Satış</td>";
$content .= "<td align=\"right\" ><b>$Euro[1] TL</td>";
$content .= "</tr>";
$content .= "</table>";
echo $content;
}

else
{

}

?>

_______________________________________________
Linux-programlama mailing list
Linux-programlama@liste.linux.org.tr
http://liste.linux.org.tr/mailman/listinfo/linux-programlama


New Message Reply About this list Date view Thread view Subject view Author view Attachment view

---------

Bu arsiv hypermail 2.1.2 tarafindan uretilmistir.