Advertisement
Guest User

Untitled

a guest
Jul 29th, 2014
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.00 KB | None | 0 0
  1. <?php
  2. $con = mysql_connect("localhost","root","");
  3. mysql_select_db('dota2stats',$con);
  4.  
  5. $url = "http://api.steampowered.com/IDOTA2Match_570/GetMatchHistory/V001/?key=6B10D3DA795C15E938753C329C86C259&account_id=STEAM_0:1:14224878";
  6. $json = file_get_contents($url);
  7. $data = json_decode($json);
  8. foreach($data->result->matches as $value) {
  9.  
  10.     if($value) {
  11.    
  12.         mysql_query("INSERT INTO evol (match_id,
  13.                                       date,
  14.                                        hero_id,
  15.                                       game_won
  16.                                       )
  17.                               VALUES ($value->match_id,
  18.                                       $value->start_time,
  19.                                        0,
  20.                                        0
  21.                                      )"
  22.         );
  23.        foreach($data->result->matches->players as $value2) {
  24.            
  25.             if (account_id == "28449757") {
  26.                
  27.                 mysql_query("INSERT INTO evol (hero_id) VALUES ($value2->hero_id)");
  28.             }
  29.     }
  30.     }
  31. }
  32.     mysql_close($con);
  33.  
  34. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement