我正在尝试使用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'];