2016-02-08 143 views
0

下面的代碼發佈到相冊中,但也發佈在主時間軸上。有沒有辦法只發布到相冊。Facebook api發佈到相冊

<?php 

    require_once __DIR__ . '/vendor/autoload.php'; 

    $fb = new Facebook\Facebook([ 
     'app_id' => 'xxxxxxxx', 
     'app_secret' => 'xxxxxxxxx', 
     'default_graph_version' => 'v2.5', 
     //'default_access_token' => '{access-token}', // optional 
    ]); 


    $data = [ 
     'message' => 'My awesome photo upload example.', 
     'source' => $fb->fileToUpload('./img/sandy.jpg'), 
    ]; 


    try { 
     // Returns a `Facebook\FacebookResponse` object 
     $response = $fb->post('/me/photos/test', $data, '{token}'); 
    } catch(Facebook\Exceptions\FacebookResponseException $e) { 
     echo 'Graph returned an error: ' . $e->getMessage(); 
     exit; 
    } catch(Facebook\Exceptions\FacebookSDKException $e) { 
     echo 'Facebook SDK returned an error: ' . $e->getMessage(); 
     exit; 
    } 

    $graphNode = $response->getGraphNode(); 

    echo 'Photo ID: ' . $graphNode['id']; 
    ?> 

回答

0

編輯:不工作從一月的2017年More info here...


這是舊的文章,我已經搜查了不同的主題,但如果我在這裏...

$data = [ 
    'message' => 'My awesome photo upload example.', 
    'source' => $fb->fileToUpload('./img/sandy.jpg'), 
    'published' => false, 
]; 
相關問題