如何使用facebook api在朋友中标记用户照片

时间:2013-02-21 12:25:43

标签: php facebook facebook-graph-api tags

如何在状态中标记照片中的朋友。下面的代码适用于多个用户添加。现在我想将它们标记为我正在上传的照片,如何做到这一点?我想要Facebook状态的确切功能,用户可以在他们写的状态中标记朋友

<html>
<head>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
    <script type="text/javascript" src="http://localhost/magento/jquery/js/jquery.tokeninput.js"></script>

    <link rel="stylesheet" href="http://localhost/magento/jquery/css/token-input.css" type="text/css" />
    <link rel="stylesheet" href="http://localhost/magento/jquery/css/token-input-facebook.css" type="text/css" />
</head>
<?php
$friend_list = file_get_contents('https://graph.facebook.com/me/friends?access_token=Your Fb token');
$friend_data = substr($friend_list,9);
$friend_detail = substr($friend_data,0,-247);
//print_r($friend_detail);
?>

<body>

    <div>
        <input type="text" id="demo-input-facebook-theme" name="blah2" />
        <script type="text/javascript">
        $(document).ready(function() {
            $("#demo-input-facebook-theme").tokenInput([<?php echo $friend_detail;?>], {
                theme: "facebook"
            });
        });
        </script>
    </div>
</body>
</html>

0 个答案:

没有答案