简体   繁体   English

Facebook,如何从任何Facebook页面获取facebook uid?

[英]facebook, how to get the facebook uid from any facebook page?

how to get the facebook uid off a page, when you visit that page? 当你访问那个页面时,如何让facebook uid离开页面?

if i go to a page of my friend or anybody, i need to know the uid. 如果我去我的朋友或任何人的页面,我需要知道这个uid。 i can get mine like this: 我可以这样得到我的:

$signed_request = $facebook->getSignedRequest();
$user_id = $signed_request['user_id'];

edit: well i have this app and i need to pull the fakebook url into the application so i can grab the id from there. 编辑:我有这个应用程序,我需要将假书的网址拉入应用程序,所以我可以从那里抓取id。 if i try, i get the app id: 如果我尝试,我得到应用程序ID:

$url = (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; 

what i need is to grab the fb link address,like @Rufinus said, something like https://graph.facebook.com/cocacola 我需要的是获取fb链接地址,就像@Rufinus所说,像https://graph.facebook.com/cocacola

any ideas? 有任何想法吗? thanks 谢谢

你只需要调用https://graph.facebook.com/cocacola就可以了。

I'm still not 100% on what you're asking. 我仍然不是100%根据你的要求。 It seems like you're definitely looking to get information about a page as opposed to a user. 看起来您肯定希望获得有关页面的信息而不是用户。

If you have an app, on a page in a tab like on the coke page , then we'll pass you a signed request that contains the id of the page . 如果你有一个应用程序,在焦炭页面上的标签页面上 ,那么我们将通过一个包含page id的签名请求。 You can then pass that to https://graph.facebook.com/{ID} and you'll get the same result as passing https://graph.facebook.com/{vanityUrl} . 然后,您可以将其传递给https://graph.facebook.com/{ID} ,您将获得与传递https://graph.facebook.com/{vanityUrl}相同的结果。

What you want to access from the signed_request is $signed_request['page']['id'] . 您想从signed_request访问的是$signed_request['page']['id']

In that same page array, you can also pull ['page']['liked'] which will tell you if the viewer has liked the page. 在同一个页面数组中,您还可以拉['page']['liked'] ,它会告诉您观看者是否喜欢该页面。 And finally you can access ['page']['admin'] which will tell you if the viewer is also an admin of that page. 最后你可以访问['page']['admin'] ,它会告诉你观众是否也是该页面的管理员。

If that doesn't answer your question, edit it a little more and i'll re-answer. 如果这不能回答您的问题,请再多编辑一次,我会重新回答。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM