• 11-09-2018, 14:03:55
    #1
    Backend Developer
    Merhabalar , bugün basit bir script yayınlayacağım script değil hatta bir index sayfası kadar
    Kullandığım api
    https://www.doviz.com/api/v1/currencies/all/latest
    Güncel Döviz Fiyatları Çeker
    json decode ile yapılmıştır

    <?php
    
    $site = file_get_contents("https://www.doviz.com/api/v1/currencies/all/latest");
    
    
    $ka = json_decode($site);
    
    /// DOLAR
    $american =$ka[0];
    $isim = $american->full_name;
    $satis = $american->selling;
    $alis =  $american->buying;
    $birim = $american->code;
    
    
    /// EURO
    $euro =$ka[1];
    
    $isim1 = $euro->full_name;
    $satis1 = $euro->selling;
    $alis1 =  $euro->buying;
    $birim1 = $euro->code;
    
    /// İNGİLİZ STERLİNİ
    $ing =$ka[2];
    
    $isim2 = $ing->full_name;
    $satis2 = $ing->selling;
    $alis2 =  $ing->buying;
    $birim2 = $ing->code;
    
    
    /// İsviçre FRANGI
    $ing =$ka[3];
    
    $isim3 = $ing->full_name;
    $satis3 = $ing->selling;
    $alis3 =  $ing->buying;
    $birim3 = $ing->code;
    
    /// İsveç KRONU
    $ing =$ka[9];
    
    $isim4 = $ing->full_name;
    $satis4 = $ing->selling;
    $alis4 =  $ing->buying;
    $birim4 = $ing->code;
    
    /// Suriye Lirası
    $ing =$ka[58];
    
    $isim5 = $ing->full_name;
    $satis5 = $ing->selling;
    $alis5 =  $ing->buying;
    $birim5 = $ing->code;
    
    
    /// Azerbeycan Manatı
    $ing =$ka[32];
    
    $isim6 = $ing->full_name;
    $satis6 = $ing->selling;
    $alis6 =  $ing->buying;
    $birim6 = $ing->code;
    /// S. Arabistan Riyali
    $ing =$ka[16];
    
    $isim7 = $ing->full_name;
    $satis7 = $ing->selling;
    $alis7 =  $ing->buying;
    $birim7 = $ing->code;?>
    
    <body bgcolor="black">
    <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
    <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
    <script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
    <!------ Include the above in your HEAD tag ---------->
    
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css" rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
    
    
    <div class="container">
    <div class="row">
    <title>Döviz Fiyatları</title>
    <br><br><br><br>
    <br>
    
    <div class="col-md-10 col-md-offset-1">
    
    <div class="panel panel-default panel-table">
    <div class="panel-heading">
    <center><strong><i class="fas fa-dollar-sign"></i> Güncel Fiyatlar <i class="fas fa-dollar-sign"></i></strong></center>
    
    <div class="row">
    <div class="col col-xs-6">
    </div>
    <div class="col col-xs-6 text-right">
    </div>
    </div>
    </div>
    <div class="panel-body">
    <table class="table table-striped table-bordered table-list">
    <thead>
    <tr>
    <th>Birimi</th>
    <th>İsmi</th>
    <th>Alış</th>
    <th>Satış</th>
    </tr>
    </thead>
    <tbody>
    <tr>
    <td align="center"><strong><?php echo $birim; ?></strong></td>
    <td align="center"><strong><?php echo $isim; ?></strong></td>
    <td align="center"><strong style="color:red"><?php echo $alis; ?></strong></td>
    <td align="center"><strong style="color:red"><?php echo $satis; ?></strong></td>
    </tr>
    
    <tr>
    <td align="center"><strong><?php echo $birim1; ?></strong></td>
    <td align="center"><strong><?php echo $isim1; ?></strong></td>
    <td align="center"><strong style="color:red" ><?php echo $alis1; ?></strong></td>
    <td align="center"><strong style="color:red"><?php echo $satis1; ?></strong></td>
    </tr>
    <tr>
    <td align="center"><strong><?php echo $birim2; ?></strong></td>
    <td align="center"><strong><?php echo $isim2; ?></strong></td>
    <td align="center"><strong><?php echo $alis2; ?></strong></td>
    <td align="center"><strong><?php echo $satis2; ?></strong></td>
    </tr>
    <tr>
    <td align="center"><strong><?php echo $birim3; ?></strong></td>
    <td align="center"><strong><?php echo $isim3; ?></strong></td>
    <td align="center"><strong><?php echo $alis3; ?></strong></td>
    <td align="center"><strong><?php echo $satis3; ?></strong></td>
    </tr>
    <tr>
    <td align="center"><strong><?php echo $birim4; ?></strong></td>
    <td align="center"><strong><?php echo $isim4; ?></strong></td>
    <td align="center"><strong><?php echo $alis4; ?></strong></td>
    <td align="center"><strong><?php echo $satis4; ?></strong></td>
    </tr>
    <tr>
    <td align="center"><strong><?php echo $birim5; ?></strong></td>
    <td align="center"><strong><?php echo $isim5; ?></strong></td>
    <td align="center"><strong><?php echo $alis5; ?></strong></td>
    <td align="center"><strong><?php echo $satis5; ?></strong></td>
    </tr>
    <tr>
    <td align="center"><strong><?php echo $birim6; ?></strong></td>
    <td align="center"><strong><?php echo $isim6; ?></strong></td>
    <td align="center"><strong><?php echo $alis6; ?></strong></td>
    <td align="center"><strong><?php echo $satis6; ?></strong></td>
    </tr>
    <tr>
    <td align="center"><strong><?php echo $birim7; ?></strong></td>
    <td align="center"><strong><?php echo $isim7; ?></strong></td>
    <td align="center"><strong><?php echo $alis7; ?></strong></td>
    <td align="center"><strong><?php echo $satis7; ?></strong></td>
    </tr>
    </table>
    </tbody>
    </div>
    
    
    </div>
    </div>
    
    </div></div></div>
    
    </body>
  • 11-09-2018, 14:07:25
    #2
    Bunu ajax ile geliştirebilirim. Müsait zamanda elinize sağlık.
  • 11-09-2018, 14:09:02
    #3
    Backend Developer
    ysf adlı üyeden alıntı: mesajı görüntüle
    Bunu ajax ile geliştirebilirim. Müsait zamanda elinize sağlık.
    Finali Bekliyorum
  • 11-09-2018, 14:19:19
    #4
    Konu sahibinin izni olursa kendi yazdığım aynı api ile coin fiyatlarını da eklemek isterim


    demo : https://sarkisozlerix.net/kadirkc/koin.php

    <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/kube/6.5.2/css/kube.min.css"/>
    <?php
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_URL, 'https://api.coinmarketcap.com/v2/ticker/?convert=TRY&limit=10');
    $s = curl_exec($ch);
    curl_close($ch);
    
    $data = json_decode($s, true);
    
    echo "<table class='unstyled striped'><tr><td colspan='3'>Koin</td></tr>";
    foreach($data[data] as $da){
    
    echo "<tr><td><img width='24px' height='24px' src='https://raw.githubusercontent.com/cjdowner/cryptocurrency-icons/master/32/color/" . strtolower($da[symbol]) . ".png' alt='" . $da[website_slug] . "'/>" . $da[name];
    
    if($da[quotes]['TRY'][percent_change_24h] < 0) echo "<i class='arrow-down'></i>"; else echo "<i class='arrow-up'></i>";
    
    echo "</td><td>" . number_format($da[quotes]['TRY'][price], 2, ',', '.') . "₺</td>" . "<td>";
    if($da[quotes]['TRY'][percent_change_24h] < 0) echo "<font color='red'>" . $da[quotes]['TRY'][percent_change_24h] . "</font>";
    else echo "<font color='green'>" . $da[quotes]['TRY'][percent_change_24h] . "</font>";
    echo "</td></tr>";
    
    }
    echo "</table>";
    ?>
    
    <style type="text/css">
    .arrow-up{
    width: 0;
    height: 0;
    content: "";
    float: right;
    margin: 5px 2px 0;
    vertical-align: top;
    display: inline-block;
    border-bottom: 10px solid #26a17b;
    border-right: 8px solid transparent;
    border-left: 8px solid transparent;
    }
    .arrow-down{
    width: 0;
    height: 0;
    content: "";
    float: right;
    margin: 6px 2px 0;
    vertical-align: top;
    display: inline-block;
    border-top: 10px solid #CC2b1b;
    border-right: 8px solid transparent;
    border-left: 8px solid transparent;
    }
    .unstyled{
    margin: auto;
    max-width: 500px;
    
    
    background: #eee;
    border: none !important;
    border-top: 3px solid #26a17b !important;
    /* box-shadow: 0 5px 15px rgba(39,40,44,.15); */
    }
    .unstyled tr:first-child{
    line-height: 30px;
    
    }
    .unstyled img{
    margin-right: 7px;
    vertical-align: top;
    display: inline-block;
    }
    .unstyled td{
    padding: 7px 10px !important;
    }
    </style>
  • 11-09-2018, 14:26:36
    #5
    Backend Developer
    KadirKC adlı üyeden alıntı: mesajı görüntüle
    Konu sahibinin izni olursa kendi yazdığım aynı api ile coin fiyatlarını da eklemek isterim


    demo : https://sarkisozlerix.net/kadirkc/koin.php

    <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/kube/6.5.2/css/kube.min.css"/>
    <?php
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_URL, 'https://api.coinmarketcap.com/v2/ticker/?convert=TRY&limit=10');
    $s = curl_exec($ch);
    curl_close($ch);
    
    $data = json_decode($s, true);
    
    echo "<table class='unstyled striped'><tr><td colspan='3'>Koin</td></tr>";
    foreach($data[data] as $da){
    
    echo "<tr><td><img width='24px' height='24px' src='https://raw.githubusercontent.com/cjdowner/cryptocurrency-icons/master/32/color/" . strtolower($da[symbol]) . ".png' alt='" . $da[website_slug] . "'/>" . $da[name];
    
    if($da[quotes]['TRY'][percent_change_24h] < 0) echo "<i class='arrow-down'></i>"; else echo "<i class='arrow-up'></i>";
    
    echo "</td><td>" . number_format($da[quotes]['TRY'][price], 2, ',', '.') . "₺</td>" . "<td>";
    if($da[quotes]['TRY'][percent_change_24h] < 0) echo "<font color='red'>" . $da[quotes]['TRY'][percent_change_24h] . "</font>";
    else echo "<font color='green'>" . $da[quotes]['TRY'][percent_change_24h] . "</font>";
    echo "</td></tr>";
    
    }
    echo "</table>";
    ?>
    
    <style type="text/css">
    .arrow-up{
    width: 0;
    height: 0;
    content: "";
    float: right;
    margin: 5px 2px 0;
    vertical-align: top;
    display: inline-block;
    border-bottom: 10px solid #26a17b;
    border-right: 8px solid transparent;
    border-left: 8px solid transparent;
    }
    .arrow-down{
    width: 0;
    height: 0;
    content: "";
    float: right;
    margin: 6px 2px 0;
    vertical-align: top;
    display: inline-block;
    border-top: 10px solid #CC2b1b;
    border-right: 8px solid transparent;
    border-left: 8px solid transparent;
    }
    .unstyled{
    margin: auto;
    max-width: 500px;
    
    
    background: #eee;
    border: none !important;
    border-top: 3px solid #26a17b !important;
    /* box-shadow: 0 5px 15px rgba(39,40,44,.15); */
    }
    .unstyled tr:first-child{
    line-height: 30px;
    
    }
    .unstyled img{
    margin-right: 7px;
    vertical-align: top;
    display: inline-block;
    }
    .unstyled td{
    padding: 7px 10px !important;
    }
    </style>

    tabiki sorun yok
  • 12-09-2018, 14:24:05
    #6
    teşekkürler arşive atalım
  • 16-01-2019, 19:33:03
    #7
    Üyeliği durduruldu
    LENOX adlı üyeden alıntı: mesajı görüntüle
    Merhabalar , bugün basit bir script yayınlayacağım script değil hatta bir index sayfası kadar
    Kullandığım api
    https://www.doviz.com/api/v1/currencies/all/latest
    Güncel Döviz Fiyatları Çeker
    json decode ile yapılmıştır

    <?php
    
    $site = file_get_contents("https://www.doviz.com/api/v1/currencies/all/latest");
    
    
    $ka = json_decode($site);
    
    /// DOLAR
    $american =$ka[0];
    $isim = $american->full_name;
    $satis = $american->selling;
    $alis =  $american->buying;
    $birim = $american->code;
    
    
    /// EURO
    $euro =$ka[1];
    
    $isim1 = $euro->full_name;
    $satis1 = $euro->selling;
    $alis1 =  $euro->buying;
    $birim1 = $euro->code;
    
    /// İNGİLİZ STERLİNİ
    $ing =$ka[2];
    
    $isim2 = $ing->full_name;
    $satis2 = $ing->selling;
    $alis2 =  $ing->buying;
    $birim2 = $ing->code;
    
    
    /// İsviçre FRANGI
    $ing =$ka[3];
    
    $isim3 = $ing->full_name;
    $satis3 = $ing->selling;
    $alis3 =  $ing->buying;
    $birim3 = $ing->code;
    
    /// İsveç KRONU
    $ing =$ka[9];
    
    $isim4 = $ing->full_name;
    $satis4 = $ing->selling;
    $alis4 =  $ing->buying;
    $birim4 = $ing->code;
    
    /// Suriye Lirası
    $ing =$ka[58];
    
    $isim5 = $ing->full_name;
    $satis5 = $ing->selling;
    $alis5 =  $ing->buying;
    $birim5 = $ing->code;
    
    
    /// Azerbeycan Manatı
    $ing =$ka[32];
    
    $isim6 = $ing->full_name;
    $satis6 = $ing->selling;
    $alis6 =  $ing->buying;
    $birim6 = $ing->code;
    /// S. Arabistan Riyali
    $ing =$ka[16];
    
    $isim7 = $ing->full_name;
    $satis7 = $ing->selling;
    $alis7 =  $ing->buying;
    $birim7 = $ing->code;?>
    
    <body bgcolor="black">
    <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
    <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
    <script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
    <!------ Include the above in your HEAD tag ---------->
    
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css" rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
    
    
    <div class="container">
    <div class="row">
    <title>Döviz Fiyatları</title>
    <br><br><br><br>
    <br>
    
    <div class="col-md-10 col-md-offset-1">
    
    <div class="panel panel-default panel-table">
    <div class="panel-heading">
    <center><strong><i class="fas fa-dollar-sign"></i> Güncel Fiyatlar <i class="fas fa-dollar-sign"></i></strong></center>
    
    <div class="row">
    <div class="col col-xs-6">
    </div>
    <div class="col col-xs-6 text-right">
    </div>
    </div>
    </div>
    <div class="panel-body">
    <table class="table table-striped table-bordered table-list">
    <thead>
    <tr>
    <th>Birimi</th>
    <th>İsmi</th>
    <th>Alış</th>
    <th>Satış</th>
    </tr>
    </thead>
    <tbody>
    <tr>
    <td align="center"><strong><?php echo $birim; ?></strong></td>
    <td align="center"><strong><?php echo $isim; ?></strong></td>
    <td align="center"><strong style="color:red"><?php echo $alis; ?></strong></td>
    <td align="center"><strong style="color:red"><?php echo $satis; ?></strong></td>
    </tr>
    
    <tr>
    <td align="center"><strong><?php echo $birim1; ?></strong></td>
    <td align="center"><strong><?php echo $isim1; ?></strong></td>
    <td align="center"><strong style="color:red" ><?php echo $alis1; ?></strong></td>
    <td align="center"><strong style="color:red"><?php echo $satis1; ?></strong></td>
    </tr>
    <tr>
    <td align="center"><strong><?php echo $birim2; ?></strong></td>
    <td align="center"><strong><?php echo $isim2; ?></strong></td>
    <td align="center"><strong><?php echo $alis2; ?></strong></td>
    <td align="center"><strong><?php echo $satis2; ?></strong></td>
    </tr>
    <tr>
    <td align="center"><strong><?php echo $birim3; ?></strong></td>
    <td align="center"><strong><?php echo $isim3; ?></strong></td>
    <td align="center"><strong><?php echo $alis3; ?></strong></td>
    <td align="center"><strong><?php echo $satis3; ?></strong></td>
    </tr>
    <tr>
    <td align="center"><strong><?php echo $birim4; ?></strong></td>
    <td align="center"><strong><?php echo $isim4; ?></strong></td>
    <td align="center"><strong><?php echo $alis4; ?></strong></td>
    <td align="center"><strong><?php echo $satis4; ?></strong></td>
    </tr>
    <tr>
    <td align="center"><strong><?php echo $birim5; ?></strong></td>
    <td align="center"><strong><?php echo $isim5; ?></strong></td>
    <td align="center"><strong><?php echo $alis5; ?></strong></td>
    <td align="center"><strong><?php echo $satis5; ?></strong></td>
    </tr>
    <tr>
    <td align="center"><strong><?php echo $birim6; ?></strong></td>
    <td align="center"><strong><?php echo $isim6; ?></strong></td>
    <td align="center"><strong><?php echo $alis6; ?></strong></td>
    <td align="center"><strong><?php echo $satis6; ?></strong></td>
    </tr>
    <tr>
    <td align="center"><strong><?php echo $birim7; ?></strong></td>
    <td align="center"><strong><?php echo $isim7; ?></strong></td>
    <td align="center"><strong><?php echo $alis7; ?></strong></td>
    <td align="center"><strong><?php echo $satis7; ?></strong></td>
    </tr>
    </table>
    </tbody>
    </div>
    
    
    </div>
    </div>
    
    </div></div></div>
    
    </body>
    eline sağlık üstad lakin site kapanmış artık çalışmıyor