Steam User Page Function
When trying to add a friend on steam through the application command “steam://friends/add/$id”, you must have the $id set to the community ID. Yes, that is the long arse number that is impossible to remember. The following function I use to extract the Community ID by inputting the username of an individual.
Note: The user must define a username through steam for this to work.
PHP:
//Quick Use Example
$cusomtid = 'username'; //change username to the variable in your software.
$communityid = get_id($cusomtid);
//Show the link.
echo "<a href='steam://friends/add/".$communityid."'>Add Friend</a>";
//Function
function get_id($data){
$data=strtolower(trim($data));
$xml = @simplexml_load_file("http://steamcommunity.com/id/".$data."?xml=1");
$steamid64=$xml->steamID64;
return $steamid64;
}
Hope it is found usefull.