How to get user information

How do I get the real name of a user that is not in my buddy list?

My first idea was to get a list of all user (nickname and real name) - but how do I get these information?

The better idea is to send a nickname to the server and get the real name in an answer - better performance if there are many users and a slow connection.

If the user is in my buddy list there is no problem to get the real name from the server.

Background: On a website is a long list with online users. You can choose one, a chat window opens (flash client) and you can chat with that user. Works fine but I don’'t want to see only the nickname of that user.

Can anyone help me to solve the problem?