<?php
####################################################
##  Script created by coRpSE
##  Owner of www.headshotdomain.net
##  For Instructions,
##  Watch: www.youtube.com/watch?v=Z_ReCpoWF8k
##
##  You are free to modify this code any way you
##  feel like, just give credit where credit is due.
##  Help by showing some support by donating to my
##  website or go to my stream, www.twitch.tv/dreadedcorpse
###################################################

$steamkey "STEAM API KEY";                 //Get your Wed Steam ID Number here: https://steamcommunity.com/dev/apikey
$steamid "YOUR ID64 NUMBER";                 //Get your steam ID64 number from here: https://steamid.io
$message_start "coRpSE has a total of ";     //First part of the message before the hours.
                                             //Trailing message after the display of the total hours. (line to edit right below this message).
$message_end " hours played in H1Z1 both in BR's and Survival. (Note: this is a rounded figure and is always updating.)";

//Lets put the URL for the API together and get it
  
$url "http://api.steampowered.com/IPlayerService/GetOwnedGames/v0001/?key=".$steamkey."&steamid=".$steamid."&format=xml&" rand();
  
$xml simplexml_load_file($url);

//what games do we want to get the info for
    
$game1 $xml->xpath("//games/message[appid = '295110']/playtime_forever")[0];
    
$game2 $xml->xpath("//games/message[appid = '433850']/playtime_forever")[0];
    
$game3 $xml->xpath("//games/message[appid = '362300']/playtime_forever")[0];
        
    
//Lets add them together!
    
$total_hours = (($game1 $game2 $game3) / 60);
    
    
//Now, lets round to the nearest hour so we don't have any decmil points
    
$total_hours = (round($total_hours));
    
    
//Now lets display our message
    
echo $message_start $total_hours $message_end;
    
?>