Grafik / REST API kullanarak yükledikten sonra Facebook Tag görüntü

0 Cevap php

Bir görüntüyü yükledikten sonra, onu etiketlemek için çalışıyorum ama görüntü yükleme sonra döndü "id" görünüşte hiçbir faydası yoktur.

Herkes aynı ulaşmak mümkün olmuştur olmadığını merak ediyorum?

function upload_image($file,$session,$message) {
    $args = array(
       'message' => $message,
    );
    $args[basename($file)] = '@' . realpath($file);
    $ch = curl_init();
    $url = 'https://graph.facebook.com/'.$album_id.'/photos?access_token='.$session['access_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); 


   $result = json_decode($data,true);

   $picture = $result['id'];

   print_r($picture);


    $json = 'https://api.facebook.com/method/photos.addTag?pid='.$picture.'&tag_text=Test&x=0&y=0&access_token='.$session['access_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);
    $data = curl_exec($ch); 

    print_r($data);




}

0 Cevap