Programalama > PHP

Etiketler: php, ile, döviz, kurları

Ort. 0
Puan ver:
<?
echo'<table  width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td>';
  $currency = array(
     "USD" => "",
     "EUR" => "",
     );

  $convert = array(
     "isim"            => "İsim",
     "forexbuying"     => "Alış",
     "forexselling"    => "Satış",
   
     );

  $content = file_get_contents("http://www.tcmb.gov.tr/kurlar/today.xml");
  foreach($currency as $code => $arr){
     preg_match("'<currency Kod=\"(".$code.")\".*>(.*)</currency>'Uis",$content,$crst);
     foreach($convert as $field => $value){
        preg_match("'<".$field.">(.*)</".$field.">'Uis",$crst[2],$frst);
        $currency[$code][$value] = $frst[1];
        }
     }


  $sen="<pre>".print_r($currency,true)."</pre>";

$sen1=str_replace('(','',$sen);
$sen2=str_replace(')','',$sen1);
$sen3=str_replace('Array','',$sen2);
$sen4=str_replace('[USD] =>','',$sen3);
$sen5=str_replace('[EUR] =>','',$sen4);
$sen6=str_replace(' ','',$sen5);
$sen7=str_replace('<pre>','',$sen6);
$sen8=str_replace('</pre>','',$sen7);
$sen9=str_replace('[İsim]=>','',$sen8);
$sen10=str_replace('AMERİKANDOLARI','<tr><td rowspan=2  bgcolor=f0f0f0><font size=2>USD</font></td><td  bgcolor=f0f0f0>',$sen9);
$sen11=str_replace('[Alış]=>','<font size=2>Alış</font></td><td  bgcolor=f0f0f0><font size=2>',$sen10);
$sen12=str_replace('[Satış]=>','</font></td></tr><tr><td  bgcolor=f0f0f0><font size=2>Satış</font></td><td  bgcolor=f0f0f0><font size=2>',$sen11);
$sen13=str_replace('EURO','</td><tr><td rowspan=2  bgcolor=f0f0f0><font size=2>EURO</font></td><td  bgcolor=f0f0f0>',$sen12);

echo"<table width='100%'  border='0' cellspacing='1' cellpadding='1'>
  <tr bgcolor='c0c0c0'>
    <td colspan='2'><div align='center'><b>TCMB Döviz Kuru</b> </div></td>
  </tr>
  <tr>
    <td width='80%' rowspan='4'>

<table width='100%' border='0' cellpadding='1' cellspacing='1'>

$sen13";

echo"</td></tr></table></td>
    <td width='20%'  bgcolor=f0f0f0><font size=2>YTL</font></td>
  </tr>
  <tr>
    <td  bgcolor=f0f0f0><font size=2>YTL</font></td>
  </tr>
  <tr>
    <td  bgcolor=f0f0f0><font size=2>YTL</font></td>
  </tr>
  <tr>
    <td  bgcolor=f0f0f0><font size=2>YTL</font></td>
  </tr>
</table></td></tr></table>";

?>

emrah ülker
emrah@planesoft.net


Yorumlar                 Yorum Yaz
Bu hazır kod'a ilk yorumu siz yapın!
KATEGORİLER
ASP - 240
ASP.NET - 24
C# - 75
C++ - 174
CGI - 8
DELPHI - 247
FLASH - 49
HTML - 536
PASCAL - 246
PERL - 11
PHP - 160
WML - 9
XML - 2
Copyright © 2002 - 2024 Hazır Kod - Tüm Hakları Saklıdır.
Siteden yararlanırken gizlilik ilkelerini okumanızı tavsiye ederiz.
hazirkod.com bir İSOBİL projesidir.