Как пометить фотографии в facebook-api?

Я хотел спросить, можно ли пометить фотографию с помощью FB API (Graph или REST).

Мне удалось создать альбом, а также загрузить в него фотографию, но я застрял на тегах.

У меня есть разрешения и правильный ключ сеанса.

Мой код до сих пор:

try {
    $uid = $facebook->getUser();
    $me = $facebook->api('/me');
    $token = $session['access_token'];//here I get the token from the $session array
    $album_id = $album[0];

    //upload photo
    $file= 'images/hand.jpg';
    $args = array(
        'message' => 'Photo from application',
    );
    $args[basename($file)] = '@' . realpath($file);

    $ch = curl_init();
    $url = 'https://graph.facebook.com/'.$album_id.'/photos?access_token='.$token;
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_HEADER, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $args);
    $data = curl_exec($ch);

    //returns the id of the photo you just uploaded
    print_r(json_decode($data,true));

    $search = array('{"id":', "}");
    $delete = array("", "");

    // picture id call with $picture
    $picture = str_replace($search, $delete, $data);

    //here should be the photos.addTag, but i don't know how to solve this
    //above code works, below i don't know what is the error / what's missing

    $json = 'https://api.facebook.com/method/photos.addTag?pid='.urlencode($picture).'&tag_text=Test&x=50&y=50&access_token='.urlencode($token);

    $ch = curl_init();
    $url = $json;
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_HEADER, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_exec($ch);
} catch(FacebookApiException $e){
    echo "Error:" . print_r($e, true);
}

Я действительно долго искал, если вы знаете что-то, что может мне помочь, пожалуйста, опубликуйте это здесь :) Спасибо за вашу помощь, Камилло

Ответы на вопрос(0)

Ваш ответ на вопрос