Facebook API would probably be the most natural. However, if you have access to Linux you can at least extract the friends' names using wget
as follows (see also wget for fetching Facebook profile/friend pageswget for fetching Facebook profile/friend pages):
wget -U Mozilla --wait 1 "https://www.facebook.com/profile.php?id=938751234570943"
This will download the publicly available content and depending on privacy settings the name of the contact will appear and could be parsed.