[英]Create link to friend's profile page from news feed array
I'm using the PHP SDK from facebook in my own application. 我在自己的应用程序中使用了来自Facebook的PHP SDK。 When I retrieve the news feed for my own profile it contains the ID for each friend that has a message on my feed.
当我检索自己个人资料的新闻提要时,其中包含在我的提要上有消息的每个朋友的ID。 Can I create a link to each persons profile page from just their facebook ID?
我可以仅从他们的Facebook ID创建指向每个个人资料页面的链接吗? Or do I have to make a separate API call for each ID and retrieve their username to create the link?
还是我必须为每个ID单独进行API调用并检索其用户名以创建链接? This is how I'm doing it now (making the api call for each friend):
这就是我现在正在做的(为每个朋友进行api调用):
$feeds = $facebook->api('/me/home');
foreach($feeds as $feed){
$friend_info = $facebook->api('/'.$feed['from']['id']);
$friend_link = $friend_info['link'];
如果您具有用户ID,则个人资料网址为: http://www.facebook.com/profile.php?id=<UID>
: http://www.facebook.com/profile.php?id=<UID>
id http://www.facebook.com/profile.php?id=<UID>
我不知道是否存在更优雅的解决方案,但我为您提供了改进代码以使用FQL
例如:
SELECT profile_url, uid FROM user WHERE uid IN (1,2,3,4,...)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.