<pre>
<?php 
include '../lib/steam.php';
$schema = open_json('http://api.steampowered.com/IEconItems_440/GetSchema/v0001/?key=' . APIKEY . '&format=json');
$data = array();
if ($schema->result->status) {
    foreach ($schema->result->items as &$item) {
        $data[$item->defindex]['name'] = $item->name;
        $data[$item->defindex]['image'] = str_replace('http://media.steampowered.com/apps/440/icons/', '', $item->image_url);
        $data[$item->defindex]['type'] = 'undefined';
        if (@$item->craft_class !== '') {
            $data[$item->defindex]['type'] = @$item->craft_class;
        }
        if (@$item->craft_material_type !== '') {
            $data[$item->defindex]['type'] = @$item->craft_material_type;
        }
    }
}
$data[0]['name'] = 'Bat';
$data[1]['name'] = 'Bottle';
$data[2]['name'] = 'Fire Axe';
$data[3]['name'] = 'Kukri';
$data[4]['name'] = 'Knife';
$data[5]['name'] = 'Fists';
$data[6]['name'] = 'Shovel';
$data[7]['name'] = 'Wrench';
$data[8]['name'] = 'Bonesaw';
$data[9]['name'] = 'Shotgun';
$data[10]['name'] = 'Shotgun';
$data[11]['name'] = 'Shotgun';
$data[12]['name'] = 'Shotgun';
Example #2
0
function open_profile($steamid)
{
    $tmp = open_json('http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=' . APIKEY . '&SteamIDs=' . $steamid . '&format=json', true);
    if (empty($tmp['response']['players'])) {
        $profile['name'] = 'Name';
        $profile['steam'] = '';
        $profile['status'] = 0;
        $profile['url'] = '#';
        $profile['avatar'] = '';
        $profile['personastate'] = 'Offline';
        $profile['success'] = false;
    } else {
        $profile['name'] = $tmp['response']['players']['0']['personaname'];
        $profile['steam'] = $tmp['response']['players']['0']['steamid'];
        $profile['status'] = $tmp['response']['players']['0']['personastate'];
        switch ($profile['status']) {
            case 1:
                $profile['personastate'] = 'Online';
                break;
            case 2:
                $profile['personastate'] = 'Busy';
                break;
            case 3:
                $profile['personastate'] = 'Away';
                break;
            case 4:
                $profile['personastate'] = 'Snooze';
                break;
            case 5:
                $profile['personastate'] = 'Looking to trade';
                break;
            case 6:
                $profile['personastate'] = 'Looking to play';
                break;
            default:
                $profile['personastate'] = 'Offline';
        }
        $profile['url'] = $tmp['response']['players']['0']['profileurl'];
        $profile['avatar'] = $tmp['response']['players']['0']['avatarmedium'];
        $profile['success'] = true;
    }
    return $profile;
}