0

我正在尝试通过 Facebook 页面创建活动。我已授予页面 id 和 create_event 权限。但是我的活动没有发布。我不断收到这个

        [message] => (#100) Invalid parameter
                [type] => OAuthException
                [code] => 100

我正在使用这些论坛中发布的以下编码

    $page_id='xxxxx';
    $event_info = array( 
    'name' => 'abc event', 
    'description' => 'hi dis s an event', 
    'owner' => 'eric example', 
    'location' => 'Location name and street', 
    'city' => 'chennai', 
    'start_time' => date('Y-m-d H:i', time()), 
    'privacy_type' => 'OPEN' ); 

     $event_id = $facebook->api('/'.$page_id.'/events', 'post', $event_info);
4

2 回答 2

1

我想通了...我在指定时间时出错了

$page_id = $_SESSION['xxxxx'];
$pid='xxxxxxx';

// Now, getting the PAGE Access token, using the user access token

 $page_token_url = "https://graph.facebook.com/$page_id?fields=access_token&" .       $access_token;
 $response = file_get_contents($page_token_url);

// Parse the return value and get the Page access token
$resp_obj = json_decode($response,true);

$page_access_token = $resp_obj['access_token'];

$event_param = array(
    'name' => 'abc event', 
    'description' => 'hi dis s an event', 
    'owner' => ' example', 
    'location' => 'Location name and street', 
    'city' => 'chennai', 
    'start_time' => '2013-12-31T13:45:00+0100', 
    'privacy_type' => 'OPEN' ,
'page_id'       => $pid
);

try
{
    $fb_event_id = $facebook->api('/'.$pid.'/events?access_token=ACCESS_TOKEN', "POST", $event_param);
}
catch (FacebookApiException $e)
{
    echo $e->getMessage();
}
于 2013-02-04T09:42:36.573 回答
-1

请使用此格式并提供访问令牌以在页面上发布

$data = array(
          "name"=>$event_name,
          "access_token"=>$fb_oauth_token,
          "start_time"=>"2014-07-04",
          "end_time"=>"2014-07-06",
          "location"=>"$location",
          "description"=>"hello"
        );
于 2014-05-29T11:32:42.303 回答