gpt4 book ai didi

facebook - 如何通过图形 API 获取 first_name?

转载 作者:行者123 更新时间:2023-11-30 05:23:33 24 4
gpt4 key购买 nike

我可以用这段代码得到图片:

https://graph.facebook.com/userid/picture

但这行不通:

https://graph.facebook.com/userid/first_name

如何获取用户名?

最佳答案

你不能像获取图片那样获取 first_name

https://graph.facebook.com/userid/?fields=first_name

会得到

{
"first_name": "Jashwant",
"id": "1137725463"
}

然后你可以通过任何json解析器得到first_name

这是GIVE_ME_THE_CODE版本,

<html>
<head>
<style>

</style>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script>
<script type='text/javascript'>
$(document).ready(function(){
$.getJSON('http://graph.facebook.com/jashwantsingh?fields=first_name',function(data){
$('<p>' + data.first_name + '<p>').appendTo('body');
})
})

</script>
</head>
<body>

</body>
</html>

关于facebook - 如何通过图形 API 获取 first_name?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10663209/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com