Facebook 如何通过graph api标记用户好友

Facebook 如何通过graph api标记用户好友,facebook,facebook-graph-api,Facebook,Facebook Graph Api,我正在使用此脚本将照片上传到用户的墙上 我从Facebook上得到了这个脚本,但我想通过graph API在照片中标记用户朋友。 有人帮我在照片中标记用户的朋友 这是我正在使用的脚本 <?php // Remember to copy files from the SDK's src/ directory to a // directory in your application on the server, such as php-sdk/ require_once('ph

我正在使用此脚本将照片上传到用户的墙上

我从Facebook上得到了这个脚本,但我想通过graph API在照片中标记用户朋友。 有人帮我在照片中标记用户的朋友

这是我正在使用的脚本

<?php

  // Remember to copy files from the SDK's src/ directory to a
  // directory in your application on the server, such as php-sdk/
  require_once('php-sdk/facebook.php');

  $config = array(
    'appId' => 'YOUR_APP_ID',
    'secret' => 'YOUR_APP_SECRET',
    'fileUpload' => true,
   );

   $facebook = new Facebook($config);
   $user_id = $facebook->getUser();

   $photo = './mypic.png'; // Path to the photo on the local filesystem
   $message = 'Photo upload via the PHP SDK!';
?>

<?php
    if($user_id) {

       // We have a user ID, so probably a logged in user.
       // If not, we'll get an exception, which we handle below.
       try {
          // Upload to a user's profile. The photo will be in the
          // first album in the profile. You can also upload to
          // a specific album by using /ALBUM_ID as the path 
          $ret_obj = $facebook->api('/me/photos', 'POST', array(
                                     'source' => '@' . $photo,
                                     'message' => $message,
                                     )
                                  );
          echo '<pre>Photo ID: ' . $ret_obj['id'] . '</pre>';
          echo '<br /><a href="' . $facebook->getLogoutUrl() . '">logout</a>';
       } catch(FacebookApiException $e) {
          // If the user is logged out, you can have a 
          // user ID even though the access token is invalid.
          // In this case, we'll get an exception, so we'll
          // just ask the user to login again here.
          $login_url = $facebook->getLoginUrl( array(
                   'scope' => 'photo_upload'
                   )); 
          echo 'Please <a href="' . $login_url . '">login.</a>';
          error_log($e->getType());
          error_log($e->getMessage());
       }   
    } else {

        // No user, print a link for the user to login
        // To upload a photo to a user's wall, we need photo_upload  permission
        // We'll use the current URL as the redirect_uri, so we don't
        // need to specify it here.
        $login_url = $facebook->getLoginUrl( array( 'scope' => 'photo_upload') );
        echo "<script type='text/javascript'>top.location.href = '$login_url';</script>"

    }

?>

您可以通过向标记连接发出POST请求,
PHOTO\u ID/tags
来标记用户的朋友

例如:


来源:

这不是教我怎么做的平台,你应该有自己的想法。请编辑您的问题,使其包括:1)您遇到的问题(错误消息)2)您的想法如何解决。rahil arora能否请您更新我的纸条,以便我能够轻松理解阅读材料然后自己实施,而不仅仅是复制和粘贴现成的解决方案。
PHOTO_ID/tags?tags=[{"tag_uid":"1234"}, {"tag_uid":"12345"}]