• I am searching for a plugin that offers my registered users to add there Steam ID or X-box URL or ID so its game statistics like wins , hours played, which game is playing ..etc .

Viewing 1 replies (of 1 total)
  • Thread Starter Hadi Syed

    (@starhadi)

    <?php
    error_reporting(0);
    $gamer_tag = “BornAgain2001”;
    $order = array(‘Title’,’LastPlayed’,’EarnedGamerscore’,’AvailableGamerscore’,’EarnedAchievements’,’AvailableAchievements’,’PercentageComplete’);
    function objectToArray($d) {
    if (is_object($d)) {
    // Gets the properties of the given object
    // with get_object_vars function
    $d = get_object_vars($d);
    }

    if (is_array($d)) {
    /*
    * Return array converted to object
    * Using __FUNCTION__ (Magic constant)
    * for recursive call
    */
    return array_map(__FUNCTION__, $d);
    }
    else {
    // Return array
    return $d;
    }
    }
    if (!empty($gamer_tag)) {
    $gamer_tag = stripslashes(strip_tags($gamer_tag));
    $gt = objectToArray(simplexml_load_file(‘https://gamercard.xbox.com/en-US/&#8217; . $gamer_tag . ‘.card’));
    $gt = $gt[‘body’][‘div’];
    $meta = explode(‘ ‘,$gt[‘@attributes’][‘class’]);
    if ($gt[‘div’][1][‘div’]==”–” || $gt[‘div’][1][‘div’]==NULL) {
    $ar[‘GamertagExists’] = FALSE;
    } else {
    $ar[‘GamertagExists’] = TRUE;
    }
    $ar[‘Gamertag’] = $gt[‘a’][0];
    $ar[‘Subscription’] = $meta[1];
    $ar[‘Gender’] = $meta[‘2’];
    $ar[‘Gamerscore’] = $gt[‘div’][1][‘div’];
    if ($gt[‘a’][1][‘img’][‘@attributes’][‘src’]==’https://image.xboxlive.com//global/t.FFFE07D1/tile/0/20000&#8242;) {
    $ar[‘Pictures’] = array();
    } else {
    $ar[‘Pictures’][‘Tile64px’] = ‘https://avatar.xboxlive.com/avatar/&#8217; . urldecode($ar[‘Gamertag’]) . ‘/avatarpic-l.png’;
    $ar[‘Pictures’][‘Tile32px’] = ‘https://avatar.xboxlive.com/avatar/&#8217; . urldecode($ar[‘Gamertag’]) . ‘/avatarpic-s.png’;
    $ar[‘Pictures’][‘FullBody’] = ‘https://avatar.xboxlive.com/avatar/&#8217; . urldecode($ar[‘Gamertag’]) . ‘/avatar-body.png’;
    }
    $ar[‘Reputation’] = 0;
    foreach($gt[‘div’][0][‘div’] as $star) {
    if ($star[‘@attributes’][‘class’] === ‘Star Full’) { $ar[‘Reputation’] = $ar[‘Reputation’]+1; }
    elseif ($star[‘@attributes’][‘class’] == ‘Star ThreeQuarter’) { $ar[‘Reputation’] = $ar[‘Reputation’]+.75; }
    elseif ($star[‘@attributes’][‘class’] == ‘Star Quarter’) { $ar[‘Reputation’] = $ar[‘Reputation’]+.25; }
    elseif ($star[‘@attributes’][‘class’] == ‘Star Half’) { $ar[‘Reputation’] = $ar[‘Reputation’]+.50; }
    }
    $ar[‘LastPlayed’] = array();
    $i = 0;
    foreach($gt[‘ol’][‘li’] as $pg) {
    if (1) {
    foreach($pg[‘a’][‘span’] as $key => $meta) {
    if ($order[$key]==’LastPlayed’) {
    $ar[‘LastPlayed’][$i][$order[$key]] = @strtotime($meta);
    } elseif ($order[$key]==’Title’) {
    $ar[‘LastPlayed’][$i][$order[$key]] = trim(str_replace(“\n”,”,preg_replace(‘/[^a-zA-Z0-9\s]/’, ‘ ‘, $meta)));
    } elseif ($order[$key]==’EarnedAchievements’||$order[$key]==’AvailableAchievements’||$order[$key]==’EarnedGamerscore’||$order[$key]==’AvailableGamerscore’) {
    $ar[‘LastPlayed’][$i][$order[$key]] = (int)$meta;
    } else {
    $ar[‘LastPlayed’][$i][$order[$key]] = str_replace(‘\n’,’ ‘,$meta);
    }
    }
    $ar[‘LastPlayed’][$i][‘Pictures’][‘Tile32px’] = $pg[‘a’][‘img’][‘@attributes’][‘src’];
    }
    $i++;
    }
    //if (isset($_GET[‘callback’])) {
    //echo strip_tags($_GET[‘callback’]) . ‘(‘;
    //}
    //echo “

    ";
    //print_r($ar);
    //echo "

    “;
    //echo stripslashes(trim(json_encode($ar)));
    //if (isset($_GET[‘callback’])) {
    //echo ‘);’;
    //}
    //} else {
    //if ($_GET[‘p’]==’examples’) {
    //$title = “Gamertag API Examples”;
    //} else {
    //$title = “Xbox 360 Gamertag API”;
    //}
    ?>
    <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “https://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”&gt;
    <html xmlns=”https://www.w3.org/1999/xhtml&#8221; xml:lang=”en”>
    <head>
    <meta http-equiv=”content-type” content=”text/html; charset=utf-8″ />
    <title>Xbox Games Info</title>
    <link rel=”stylesheet” href=”/style.css”/>
    </head>
    <body>
    <div id=”container”>
    <div>
    <?php if(is_array($ar) && in_array(‘GamertagExists’, $ar) && $ar[‘GamertagExists’]==’1′){
    ?>
    <div>Gamertag=><?php echo $ar[‘Gamertag’];?></div>
    <div>Subscription=><?php echo $ar[‘Subscription’];?></div>
    <div>Gender=><?php echo $ar[‘Gender’];?></div>
    <div>Gamer Score=><?php echo $ar[‘Gamerscore’];?></div>
    <div>Reputation=><?php echo $ar[‘Reputation’];?></div>
    <div><img src=”<?php echo $ar[‘Pictures’][‘Tile64px’];?>”></img></div>

    </br>
    <div> <h1>Last Played Game</h1> </div>
    <?php foreach ($ar[‘LastPlayed’] as $value) {
    ?>
    <div> Title
    <?php echo $value[‘Title’];?>
    </div>
    <div> Date
    <?php echo date(‘Y-m-d’, $value[‘LastPlayed’]);?>
    </div>
    <div> Score
    <?php echo $value[‘EarnedGamerscore’];?>
    </div>
    <div> Available Gamer Score
    <?php echo $value[‘AvailableGamerscore’];?>
    </div>
    <div> Earned Achievements
    <?php echo $value[‘EarnedAchievements’];?>
    </div>
    <div> Available Achievements
    <?php echo $value[‘AvailableAchievements’];?>
    </div>
    <div> Percentage Complete
    <?php echo $value[‘PercentageComplete’];?>
    </div>
    <div>
    <img src=”<?php echo $value[‘Pictures’][‘Tile32px’];?>”></img>
    </div>
    <?php
    }//End Foreach
    }//End IF
    ?>
    </div>
    </div>
    <div id=”footer”>
    Copy right hadi ©-<?php echo date(‘Y’); ?>
    </div>
    </body>
    </html>
    <?php
    }
    die();
    ?>

Viewing 1 replies (of 1 total)
  • The topic ‘Plugin for Steam and X-box’ is closed to new replies.