Skip to content
Advertisement

How to Getting SteamID64 ID with Steam Trade Url

I’m working on a project, I know that I can somehow get the steam trade url to the steamid64 id and I came up with something like

$split = explode(":", $steamid); // STEAM_?:?:??????? format

$x = substr($split[0], 6, 1);
$y = $split[1];
$z = $split[2];

$w = ($z * 2) + 0x0110000100000000 + $y;

this code converts “steamid” id to “steamid64” id very successfully.

an example trade url as below

https://steamcommunity.com/tradeoffer/new/?partner=487364592&token=xxxxxxxx

“partner=487364592” this part is actually a steamid3 id and i know we can take this id and convert it to steamid64

Example: [U:1:487364592]

I know there is more than one way to do this, but no matter which way I try, I cannot succeed. There are too many mathematical operations.

my whole goal is to reach the steamid64 id with the partner id in the trade url on php

What is the simplest way to do this on php?

Advertisement

Answer

The formula to calculate SteamID64 from AccountID (partner ID) is:

(universe << 56) | (type << 52) | (instance << 32) | account_id

In your case:

(1 << 56) | (1 << 52) | (1 << 32) | 487364592

Result:

76561198447630320

For trade offers (partner ID), the values for universe, type and instance are always 1.

Other possible values can be found here: https://github.com/DoctorMcKay/node-steamid/blob/master/index.js#L2-L50

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement