<?php
$btc = json_decode(file_get_contents('https://btc-e.com/api/2/btc_rur/ticker/'), true);
$ticker = $btc['ticker'];
$ticker['avg'];
echo "Продать: ".$ticker['sell']." Руб.";
echo '</b> <br>';
echo "Купить : ".$ticker['buy']." Руб.";
echo '</b> <br>';
echo '<b><font color=" #00CC33" size="3">Обновлено: <font color="#00CC33">';
$timestamp = $ticker['updated'];
echo strftime('%H:%M:%S',$timestamp);
?>
<?php
$file='btc_status.lock';
if(!flock($lock_file = fopen($file, 'w'), LOCK_EX | LOCK_NB))
die("Already runninng\n");
include 'config_db.php';
include 'safemysql.class.php';
$db = new SafeMysql();
$fl=json_decode(file_get_contents("https://btc-e.com/api/3/ticker/btc_usd-ltc_usd?ignore_invalid=1"));
$btc=$fl->btc_usd;
if($btc->last>0)
{
//$sql = "INSERT INTO kurs SET mark = 'btce', date=NOW(), ?u"; // Для чего это?
$db->query("INSERT INTO kurs (mark, sell) VALUES ('btce',{$btc->sell})");
}
mysql_close();
?>
<?php
$file='btc_status.lock';
if(!flock($lock_file = fopen($file, 'w'), LOCK_EX | LOCK_NB))
die("Already runninng\n");
include("config.php");
mysql_query("SET names utf8");
$fl=json_decode(file_get_contents("https://btc-e.com/api/3/ticker/btc_usd-ltc_usd?ignore_invalid=1"));
//print_r($fl);
$btc=$fl->btc_usd;
$ltc=$fl->ltc_usd;
$timestamp=time();
if($btc->last>0)
{
mysql_query("INSERT INTO btc_charts_live (mark, date, low, high, buy, sell, volume, last) VALUES ('btce',$timestamp,{$btc->low},{$btc->high},{$btc->buy},{$btc->sell},{$btc->vol},{$btc->last})");
}
if($ltc->last>0)
{
mysql_query("INSERT INTO ltc_charts_live (mark, date, low, high, buy, sell, volume, last) VALUES ('btce',$timestamp,{$ltc->low},{$ltc->high},{$ltc->buy},{$ltc->sell},{$ltc->vol},{$ltc->last})");
}
mysql_close();
если не трудно, приведите свой пример.
include 'safemysql.class.php';
$db = new safeMysql();
$sql = "INSERT INTO btc_charts_live SET mark = 'btce', date=NOW(), ?u";
$db->query("INSERT INTO btc_charts_live SET ?u", $btc);
<?php
$file='btc_status.lock';
if(!flock($lock_file = fopen($file, 'w'), LOCK_EX | LOCK_NB))
die("Already runninng\n");
include("config_db.php");
include 'safemysql.class.php';
$db = new SafeMysql();
$fl=json_decode(file_get_contents("https://btc-e.com/api/3/ticker/btc_usd-ltc_usd?ignore_invalid=1"));
$btc=$fl->btc_usd;
if($btc->last>0)
{
$sql = "INSERT INTO kurs SET mark = 'btce', date=NOW(), ?u";
$db->query->("INSERT INTO kurs SET ?u", $btc);
}
mysql_close();
?>
$db->query->("INSERT INTO kurs SET ?u", $btc);
.......
if($btc->last>0)
{
$sql = "INSERT INTO kurs SET mark = 'btce', date=NOW(), ?u";
$result = $db->query("kurs");
while ($row = $db->fetch($result))
{
echo $row['name'];
}
}
mysql_close();
$result = $db->query("kurs");
trigger_error($err,E_USER_ERROR);