2013-05-03 85 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'];