2013-05-03 71 views
1

我想使用location_id,這是我從我目前的位置檢索,作爲Facebook的事件創建一個參數,這裏是我的代碼:LOCATION_ID爲Facebook創建活動

我已經建立了所有的授權令牌和擴展許可,並且它確實返回了有效的位置ID;但是,在將location_id插入事件創建參數數組後,它沒有創建事件。 (所有其他領域通過表單設置)。任何人都可以幫忙嗎?

這裏是我的代碼:

try{ 
    //default location 
    $event_url = $my_url . 'create_group.php'; 
    $event_location = $facebook->api('/me?fields=location'); 
    $event_location_id = $event_location['id']; 
    echo $event_location_id; 
    } 

    catch(Exception $e) 
    { 
    echo $e; 
    } 



$params= array(

    "name" => "[Study Group]".$_POST['name'], 
    "description" => $_POST['description'], 
    "location_id" => $event_location_id, 
    "start_time" => $_POST['start_time'].$_POST['time_zone'], 
    "privacy_type" => $_POST['privacy_type'], 
    "end_time" => $_POST['end_time'].$_POST['time_zone'] 
); 

這裏是例外,我有:

Exception: The place or event you attempted to plan to attend is invalid. Please try a different place or event. 

唯一的例外是這樣解決的方式如下: 變化:

$event_location_id = $event_location['id']; 

$event_location_id= $event_location['location']['id']; 
+0

你得到任何錯誤取回?還請在您的問題中添加活動發佈的代碼 – 2013-05-03 07:51:09

+0

我已添加例外 – 2013-05-03 07:56:14

+0

請添加您的代碼以發佈活動。 – 2013-05-03 07:59:33

回答

0

異常告訴自己該錯誤是Location Id的錯誤值。 正如您自行調試它,這是因爲你檢索它作爲

$event_location_id = $event_location['id']; 

哪些應該改爲爲

$event_location_id= $event_location['location']['id'];