xRo*_*bot 5 facebook facebook-graph-api
我可以用这段代码得到图片:
https://graph.facebook.com/userid/picture
Run Code Online (Sandbox Code Playgroud)
但这不起作用:
https://graph.facebook.com/userid/first_name
Run Code Online (Sandbox Code Playgroud)
我怎样才能获得用户名?
Jas*_*ant 10
你不能得到first_name
像你正在拍照.
https://graph.facebook.com/userid/?fields=first_name
会得到的
{
"first_name": "Jashwant",
"id": "1137725463"
}
Run Code Online (Sandbox Code Playgroud)
然后你可以first_name
通过任何json解析器获得.
这是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>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
23664 次 |
最近记录: |