<?php define('DB_HOST', 'localhost'); define('DB_USER', 'root'); define('DB_PASS', ''); define('DB_NAME', 'prise'); $conn = mysql_connect(DB_HOST, DB_USER, DB_PASS); if (!mysql_connect(DB_HOST, DB_USER, DB_PASS)) { exit('Cannot connect to server'); } if (!mysql_select_db(DB_NAME)) { exit('Cannot select database'); } mysql_query('SET NAMES utf8'); 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']; $sql = "INSERT INTO prise (weapon, price) VALUES('$weapon','$price')"; } } if ( isset ($_POST['update']) ) { // нажата кнопка: parseCSMONEY(); echo "обновлено";
}