It doesn't work with X-Realm because you can't add X-Realm to your friends list. You have 2 options:
- Bug Blizzard to add x-realm support to the standard friends list
- Bug Blizzard to add level information to GetPlayerInfoByGUID()
The former is more probable.