<?php
define('DB_HOST', 'localhost');
define('DB_USER', 'root');
define('DB_PASS', '');
define('DB_NAME', 'prise');
$link = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
if (mysqli_connect_errno()) {
echo "Не удалось подключиться: %s\n";
exit();
}
function parseCSMONEY(){
mb_internal_encoding("UTF-8");
$url = 'https://cs.money/load_all_bots_inventory?hash=1496393591316';
$file = file_get_contents($url);
$jsondate = json_decode($file, true);
//echo $file;
foreach ($jsondate[ponyismylife] as $bot1) {
$weapon = $bot1['m'];
$price = $bot1['p'];
$query = "SELECT * FROM price WHERE weapon=$weapon";
if ($result = mysqli_query($link, $query, MYSQLI_USE_RESULT)) {
if ($result > 0) {
$sql = "UPDATE price SET price=`$price` WHERE weapon=`$weapon`";
}
elseif($result == 0){
$sql = "INSERT INTO price (weapon, price) VALUES (`$weapon`,`$price`)";
$finall = mysqli_query($sql);
}
mysqli_free_result($result);
}
}
}
очень долго...
но мне нужно получать данные из бд, и обрабатывать их.