Skip to content

Instantly share code, notes, and snippets.

@barisesen
Last active November 7, 2018 10:31
Show Gist options
  • Save barisesen/1f003721e40a7b0808445b6c7701b28a to your computer and use it in GitHub Desktop.
Save barisesen/1f003721e40a7b0808445b6c7701b28a to your computer and use it in GitHub Desktop.
Tcmb günlük kurlar php http://www.tcmb.gov.tr/kurlar/today.xml
<?php
// bloomberght anlık
$ch = curl_init();
curl_setopt($ch, CURLOPT_REFERER, 'http://www.google.com');
curl_setopt($ch, CURLOPT_URL, "http://www.bloomberght.com/doviz/dolar/");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$site = curl_exec($ch);
curl_close($ch);
$re = '/<span class="col-lg-4 col-md-6 col-sm-6 col-xs-12 piyasaDataValues">[\n]*\s+<span>SATIŞ.*<b>(.*?)<\/b>/mi';
preg_match($re, $site, $matches);
echo($matches[1]);
<?php
// finansbank anlık
$ch = curl_init();
curl_setopt($ch, CURLOPT_REFERER, 'http://www.google.com');
curl_setopt($ch, CURLOPT_URL, "https://www.qnbfinansbank.com/doviz-kur-bilgileri/");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$site = curl_exec($ch);
curl_close($ch);
preg_match_all('@<td class="tutarNoTl right">(.*?)</td>@si',$site,$veri);
echo $veri[1][1];
<?php
// tcmb günlük
$ch = curl_init();
curl_setopt($ch, CURLOPT_REFERER, 'http://www.google.com');
curl_setopt($ch, CURLOPT_URL, "http://www.tcmb.gov.tr/kurlar/today.xml");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$site = curl_exec($ch);
curl_close($ch);
$site = simplexml_load_string($site);
$selling = $site->Currency[0]->ForexSelling[0];
echo $selling;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment