turkcedil
> Anasayfa > Makaleler > PHP > Merkez Bankasi Döviz Kurlari ( Php - xml-Rpc Currency webservice)
Web Galeriden
150 Badges with PSD
Attachment
Merkez Bankasi Döviz Kurlari ( Php - xml-Rpc Currency webservice)
Tarih 14/04/2010 16:38  Yazar Huseyin AKTURAN  Hitler 2032  Dil Turkish
PHP ile  XML-RPC  kullanarak merkez bankasi döviz kurlarini cekmek.

index.php


<?php
include('doviz.php');
echo "<link href=\"styl.css\" rel=\"stylesheet\" type=\"text/css\" />";
$doviz->kurlar();

?>


doviz.php


<?php
/**
 * Das Programm list erst aktuelle wechselkurse von Central Bank Turkey aus, dann liefert es aktuelle wechselkurse.
 * @return aktuelle wechselkurse
 * @author Huseyin AKTURAN
 * @category Xml in PHP webservices
 * 2010.04.14 in Karlsruhe / Germany
 */

class doviz{
   
    public function kurlar(){
       
     $l_URL = "http://www.tcmb.gov.tr/kurlar/today.xml";
     $l_cURL = curl_init();
     curl_setopt( $l_cURL, CURLOPT_RETURNTRANSFER, true );
     curl_setopt( $l_cURL, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
     curl_setopt( $l_cURL, CURLOPT_URL, $l_URL );
     $xmlResponse = curl_exec( $l_cURL );
    
       if( $xmlResponse ) {
            $i=0;
               $l_Response = simplexml_load_string( $xmlResponse );
               echo "<table border=0 align=center><tr>";
               echo "<td class=\"helpHed\">Döviz Adi</td>";
               echo "<td class=\"helpHed\">Currency Name</td>";
               echo "<td class=\"helpHed\">Döviz Alis</td>";
               echo "<td class=\"helpHed\">Döviz Satis</td>";
               echo "<td class=\"helpHed\">Efektif Alis</td>";
               echo "<td class=\"helpHed\">Efektif Satis</td>";
               echo "</tr>";
              
                   while($i < count($l_Response -> Currency)){
                      
                       echo "<tr>";
                    echo "<td class=\"helpBod\">".$l_Response -> Currency[$i] -> Isim."</td>";
                    echo "<td class=\"helpBod\">".$l_Response -> Currency[$i] -> CurrencyName."</td>";
                    echo "<td class=\"helpBod\">".$l_Response -> Currency[$i] -> ForexBuying."</td>";
                    echo "<td class=\"helpBod\">".$l_Response -> Currency[$i] -> ForexSelling."</td>";
                    echo "<td class=\"helpBod\">".$l_Response -> Currency[$i] -> BanknoteBuying."</td>";
                    echo "<td class=\"helpBod\">".$l_Response -> Currency[$i] -> BanknoteSelling."</td>";
                    echo "</tr>";
                   
                        if ($i=="12"){
                           
                            return;
                        }
                       
                   $i++;
                   } // while
                   echo "</table>";
       }//if
    } // kurlar();
}
$doviz=new doviz();
?>


styl.css


table.helpT
{ text-align: center;
font-family: Verdana;
font-weight: normal;
font-size: 11px;
color: #404040;
width: 800px;
background-color: #fafafa;
border: 1px #6699CC solid;
border-collapse: collapse;
border-spacing: 0px; }

td.helpHed
{ border-bottom: 2px solid #6699CC;
border-left: 1px solid #6699CC;
background-color: #BEC8D1;
text-align: left;
text-indent: 5px;
font-family: Verdana;
font-weight: bold;
font-size: 11px;
color: #404040; }

td.helpBod
{ border-bottom: 1px solid #9CF;
border-top: 0px;
border-left: 1px solid #9CF;
border-right: 0px;
text-align: left;
text-indent: 10px;
font-family: Verdana, sans-serif, Arial;
font-weight: normal;
font-size: 11px;
color: #404040;
background-color: #fafafa; }

td.helpBod1
{ border-bottom: 1px solid #9CF;
border-top: 0px;
border-left: 1px solid #9CF;
border-right: 0px;
text-align: left;
text-indent: 10px;
font-family: Verdana, sans-serif, Arial;
font-weight: normal;
font-size: 11px;
color: #404040;
 }

table.sofT
{ text-align: center;
font-family: Verdana;
font-weight: normal;
font-size: 11px;
color: #404040;
width: 100%;
background-color: #fafafa;
border: 1px #6699CC solid;
border-collapse: collapse;
border-spacing: 0px; }
 
pskology
gerçektende çok yararlı bir site. . .
26
Ara