Coder Social home page Coder Social logo

csgo's Introduction

csgo

GitHub issues GitHub stars

A php-powered web page that shows a Steam user's Counter Strike: Global Offensive items.

Hacking / Changing

To use a different Steam game for the inventory, simple change the app id on line 3.

<?php
// Change
$query = "http://steamcommunity.com/id/".$id."/inventory/json/730/2/";
// to
$query = "http://steamcommunity.com/id/".$id."/inventory/json/440/2/";

Helper Function

<?php

function getUserInventory($id, $app = 730) {
    $url = "http://steamcommunity.com/id/" . $id . "/inventory/json/" . $app . "/2/";
    $res = file_get_contents($url);
    $data = json_decode($res, true);
    return $data["rgDescriptions"];
}

$items = getUserInventory("m0nty_tv");

Steam API Example

<?php
// Steam ID of user
$id = "m0nty_tv";

// Get JSON Data from Steam API
$json = file_get_contents("http://steamcommunity.com/id/".$id."/inventory/json/730/2/");

// Convert JSON string to array
$data = json_decode($json, true);

// Get the array of items
$items = $data["rgDescriptions"];

// Log a list of the items
foreach($items as $item) {
    echo $item["name"] . "<br>";
}
XM1014 | Blue Spruce
Dual Berettas | Contractor
PP-Bizon | Urban Dashed
MP7 | Army Recon
SCAR-20 | Sand Mesh
G3SG1 | Desert Storm
MAG-7 | Metallic DDPAT
Operation Vanguard Weapon Case
Huntsman Weapon Case
MP9 | Dart
Operation Breakout Weapon Case
AK-47 | Redline
M4A1-S | Guardian
Souvenir MAG-7 | Irradiated Alert
P250 | Supernova
StatTrak™ Galil AR | Blue Titanium
Operation Vanguard Challenge Coin

$item

In the example, you can use any of the following attributes.

<?php

// Instead of
foreach($items as $item) {
    echo $item["name"] . "<br>";
}

// You could use
foreach($items as $item) {
    echo "<img src='http://cdn.steamcommunity.com/economy/image/" . $item["icon_url_large"] . "'><br>";
}

// Please note that images must have "http://cdn.steamcommunity.com/economy/image/" prepended before $item["icon_url_large"]
appid
classid
instanceid
icon_url
icon_url_large
icon_drag_url
name
market_hash_name
market_name
name_color
background_color
type
tradable
marketable
commodity
market_tradable_restriction
descriptions
actions
market_actions
tags

csgo's People

Contributors

nextlevelshit avatar

Watchers

Sahaj Dave avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.