2012-03-02 83 views
0

我正嘗試在Facebook上代表我使用Graph API擁有的頁面創建事件。 從FB文檔我讀,它是這樣完成的:使用rGraph創建Facebook事件頁面API

POST操作namestart_time(其他東西都是可選的),以 https://graph.facebook.com/ {PAGE_ID} /事件

適當premissions(create_eventmanage_pages

在Graph API Explorer中玩弄這個,我確實創建了事件,但它是在我自己的配置文件而不是Page下完成的。

那麼是否有可能在頁面下創建事件,而不是我的個人資料?

PS我雙重檢查頁ID,所以它不是我的個人資料的ID

PPS我知道有這個媒體鏈接多次討論這裏,但我unfortunatley不可能發現一個直截了當的回答我的問題。

回答

0

所以我想出了自己。我需要使用頁面訪問令牌發佈它。繼承人代碼

$page_info = $this->fb->api('/' . $page_id . '?fields=access_token'); 
if (!empty($page_info['access_token'])) { 

$path = realpath(APPPATH . '../path/to/img'); 
$args = array(
    'access_token' => $page_info['access_token'], 
    'start_time' => $start_time, 
    'description' => $description 
    'name' => $name, 
    'location' => $loaction 
); 
$img = 'img.jpg'; 
if ($upload) {// if picture is needed 
    $args['@' . $img] = '@' . $path . '/' . $img; 

    $this->fb->setFileUploadSupport(true); 
} 

$res = $this->fb->api("/" . $this->input->post('fb_event'), "post", $args); // should give back event id   
} 
+0

這實際上並不能幫助任何需要它的人,因爲您發佈的代碼沒有提供足夠的洞察力。 – 2014-02-11 22:13:51

相關問題