Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $user = 'root';//Seu usuário do banco de dados
- $pass = '???';//Seu senha de conexão.
- $conn = new PDO('mysql:host=localhost;dbname=test', $user, $pass);
- $destUrl = 'http://steamcommunity.com/profiles/' . $steamid . '/inventory/json/730/2/';
- $data = file_get_contents($destUrl, false);
- $data = json_decode($data, true);
- $data1= array_keys($data['rgDescriptions']);
- $data2= $data['rgDescriptions'];
- $conn->beginTransaction();
- $sql = 'INSERT INTO sua_tabela (id, name, market_hash_name, market_name)
- VALUES (?, ?, ?, ?)';
- $conn = $dbh->prepare($sql);
- for($i = 0; $i < count($data1); ++$i) {
- $conn->execute(array(
- $data1[$i],
- $data2[$data1[$i]]['name'],
- $data2[$data1[$i]]['market_hash_name'],
- $data2[$data1[$i]]['market_name'];
- ));
- }
- $dbh->commit();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement