How to tag photos in facebook-api?

后端 未结 3 2071
暖寄归人
暖寄归人 2020-12-30 16:17

I wanted to ask if/how is it possible to tag a photo using the FB API (Graph or REST).

I\'ve managed to create an album and also to upload a photo in it, but I stuck

3条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-30 16:42

    I found out the problem, the problem is that when you use curl to send the array the post function will not send the array correctly, it was sending just "Array" that it was why the graph API complained about tags being an array. To solve that I did the following:

    $data = array(array('tag_uid' => $taguser,
                      'x' => rand() % 100,
                      'y' => rand() % 100
                      ));
    
    $data = json_encode($data);
    
    $photo_details = array(
     'message'=> $fnames,
     'tags' => $data
    );
    

    Now I just send using curl

    curl_setopt($ch, CURLOPT_POSTFIELDS, $photo_details);
    

提交回复
热议问题