public function getUpdatelive()
 {
     $livelist = SteamApi::getlive();
     $games = $livelist->result->games;
     // Update livematches
     foreach ($games as $match) {
         $match_row = LiveMatches::where('match_id', '=', $match->match_id)->first();
         if ($match_row == false) {
             $match_row = new LiveMatches();
             $match_row->match_id = json_encode($match->match_id);
             $match_row->league_id = json_encode($match->league_id);
             $match_row->players = json_encode($match->players);
             $match_row->radiant = json_encode($match->radiant_team->team_id);
             $match_row->dire = json_encode($match->dire_team->team_id);
             $match_row->data = json_encode($match);
             $match_row->save();
         } else {
             $match_row->match_id = json_encode($match->match_id);
             $match_row->league_id = json_encode($match->league_id);
             $match_row->players = json_encode($match->players);
             $match_row->radiant = json_encode($match->radiant_team->team_id);
             $match_row->dire = json_encode($match->dire_team->team_id);
             $match_row->data = json_encode($match);
             $match_row->save();
         }
     }
     return $view = View::make('default.admin.edit.livematches');
 }
 public function fetch_backpack($sid)
 {
     if ($sid != false) {
         $user_row = SteamUserBackpack::where('steamid64', '=', $sid)->first();
         $backpack = SteamApi::steaminven($sid);
         //print_r(gettype($backpack['inventory']));
         if ($user_row == false) {
             $user_row = new SteamUserBackpack();
             $user_row->steamid64 = $sid;
             $user_row->backpack = json_encode($backpack['inventory']);
             $user_row->descriptions = json_encode($backpack['descriptions']);
             $user_row->save();
         } else {
             $user_row->backpack = json_encode($backpack['inventory']);
             $user_row->descriptions = json_encode($backpack['descriptions']);
             $user_row->save();
         }
     }
 }
 public function getUpdateleague()
 {
     $getleague = SteamApi::getleague();
     $leagues = $getleague->result->leagues;
     foreach ($leagues as $item) {
         $item_row = League::where('id', '=', $item->leagueid)->first();
         if ($item_row == false) {
             $item_row = new League();
             $item_row->id = $item->leagueid;
             $item_row->name = $item->name;
             $item_row->description = $item->description;
             $item_row->defindex = $item->itemdef;
             $item_row->save();
         } else {
             $item_row->id = $item->leagueid;
             $item_row->name = $item->name;
             $item_row->description = $item->description;
             $item_row->defindex = $item->itemdef;
             $item_row->save();
         }
     }
     return $view = View::make('default.admin.edit.leagueschema');
 }
Example #4
0
 public function getUpdateschema()
 {
     //$itemschema = SteamApi::itemschema();
     $doc = new DOMDocument();
     $start = 0;
     $count = 100;
     $gid = 730;
     $max = 999;
     $i = 0;
     $marketlist = SteamApi::getMarket($start, $count, $gid);
     //$listutf8 = htmlentities($marketlist->results_html, NULL, 'UTF-8');
     $max = $marketlist->total_count;
     $doc->loadHTML($marketlist->results_html);
     $xpath = new DOMXPath($doc);
     $marketitems = $xpath->query("//*[contains(concat(' ', normalize-space(@class), ' '), 'market_listing_row_link')]");
     //var_dump($itemlist);
     foreach ($marketitems as $marketitem) {
         $item["marketlink"] = $marketitem->getAttribute("href");
         $item["markethash"] = substr($item["marketlink"], strrpos($item["marketlink"], '/') + 1);
         $item["marketname"] = urldecode($item["markethash"]);
         $getitemname = explode("%28", $item["markethash"]);
         $item["itemname"] = urldecode($getitemname[0]);
         $itemvalue = SteamApi::getItemValue($item["markethash"], $gid);
         if ($itemvalue == null) {
             $item["value"] = 0;
         } else {
             $item["value"] = substr($itemvalue->lowest_price, 5);
         }
         preg_match_all("/\\(([^)]+)\\)/", $item["marketname"], $matches);
         if ($matches[1][0]) {
             $item["exterior"] = $matches[1][0];
         } else {
             $item["exterior"] = "";
         }
         /*$getvalue = $xpath->query("//*[contains(concat(' ', normalize-space(@class), ' '), 'market_table_value')]", $marketitem);
         		$values = $xpath->query("//*[contains(concat(' ', normalize-space(@style), ' '), 'color:white')]", $getvalue->item(0));
         		foreach($values as $value)
         		{						
         			//var_dump($value);
         		}*/
         $items[] = $item;
     }
     //print_r($items);
     foreach ($items as $item) {
         $item_row = ItemSchema::where('markethashname', '=', $item["markethash"])->first();
         if ($item_row == false) {
             $item_row = new ItemSchema();
             $item_row->itemname = $item["itemname"];
             $item_row->marketname = $item["marketname"];
             $item_row->markethashname = $item["markethash"];
             $item_row->marketlink = $item["marketlink"];
             $item_row->minvalue = $item["value"];
             $item_row->exterior = $item["exterior"];
             //$item_row->imagenormal       = $item["imagenormal"];
             $item_row->save();
         } else {
             $item_row->itemname = $item["itemname"];
             $item_row->marketname = $item["marketname"];
             $item_row->markethashname = $item["markethash"];
             $item_row->marketlink = $item["marketlink"];
             $item_row->minvalue = $item["value"];
             $item_row->exterior = $item["exterior"];
             //$item_row->imagenormal       = $item["imagenormal"];
             $item_row->save();
         }
     }
     return $view = View::make('default.admin.edit.itemschema');
 }
Example #5
0
<pre><?php 
// Require classes
require_once "/SteamApi/load.php";
// Initialize API
$api = new SteamApi();
// Set Steam API key
$api->key("STEAM_API_KEY");
//	Player
$player = $api->player();
// Find Steam Player by steamid|customurl|profileurl
$player->find("Tnifey");
// https://api.steampowered.com/ISteamUser/ResolveVanityURL/v1/?key={$this->key}&format=json&vanityurl={$this->query}&url_type=1
// If player exist
if ($player->exist) {
    // Player summaries
    $player->summaries()->summaries;
    // https://api.steampowered.com/ISteamUser/GetPlayerSummaries/v2/?key={$this->key}&format=json&steamids={$this->steamid}
    // Player bans
    $player->bans()->bans;
    // https://api.steampowered.com/ISteamUser/GetPlayerBans/v1/?key={$this->key}&format=json&steamids={$this->steamid}
    // If player profile is public
    if ($player->public) {
        // Player friends
        $player->friends()->friends;
        // https://api.steampowered.com/ISteamUser/GetFriendList/v1/?key={$this->key}&format=json&steamid={$this->steamid}
        // Player groups
        $player->groups()->groups;
        // https://api.steampowered.com/ISteamUser/GetUserGroupList/v1/?key={$this->key}&format=json&steamid={$this->steamid}
        // Player games
        $player->games()->games;
        // https://api.steampowered.com/IPlayerService/GetOwnedGames/v1/?key={$this->key}&format=json&steamid={$this->steamid}&include_appinfo=1&include_played_free_games=1