Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Untitled Document</title>
- </head>
- <body>
- <?php
- //$url='http://twitter.com/statuses/user_timeline/16387631.json'; //rss link for the twitter timeline
- //print_r(get_data($url)); //dumps the content, you can manipulate as you wish to
- /* gets the data from a URL */
- function get_data($url)
- {
- $ch = curl_init();
- $timeout = 5;
- curl_setopt($ch,CURLOPT_URL,$url);
- curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
- curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
- $data = curl_exec($ch);
- curl_close($ch);
- return $data;
- }
- $url='http://www.tcmb.gov.tr/kurlar/today.xml';
- $content=get_data($url);
- //$content = file_get_contents("http://www.tcmb.gov.tr/kurlar/today.xml");
- $dolar_bul = explode('<Currency Kod="USD" CurrencyCode="USD">' ,$content);
- $dolar_bul = explode('</ForexBuying>',$dolar_bul[1]);
- $dolar_alis = explode('<ForexBuying>',$dolar_bul[0]);
- $dolar_bul = explode('</ForexSelling>',$dolar_bul[1]);
- $dolar_satis = explode('<ForexSelling>',$dolar_bul[0]);
- $dolar_alis = $dolar_alis[1];
- $dolar_satis = $dolar_satis[1];
- $euro_bul = explode('<Currency Kod="EUR" CurrencyCode="EUR">' ,$content);
- $euro_bul = explode('</ForexBuying>',$euro_bul[1]);
- $euro_alis = explode('<ForexBuying>',$euro_bul[0]);
- $euro_bul = explode('</ForexSelling>',$euro_bul[1]);
- $euro_satis = explode('<ForexSelling>',$euro_bul[0]);
- $euro_alis = $euro_alis[1];
- $euro_satis = $euro_satis[1];
- ?>
- <span style="color: #FFF; text-decoration: none;">Dolar Alış:</span> <span style="color: #C60;"><?php echo $dolar_alis; ?>, </span>
- <span style="color: #FFF; text-decoration: none;">Dolar Satış:</span> <span style="color: #C60;"><?php echo $dolar_satis; ?>, </span>
- <span style="color: #FFF; text-decoration: none;">Euro Alış:</span> <span style="color: #C60;"><?php echo $euro_alis; ?>, </span>
- <span style="color: #FFF; text-decoration: none;">Euro Satış:</span> <span style="color: #C60;"><?php echo $euro_satis; ?></span>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment