在facebook上发布事件与php的配置文件
问题描述:
我想用Graph API和PHP发布一个事件给我的Facebook配置文件。 我已成功创建了一个活动,但未将其发布到我的个人资料中,但仅发布在我的应用页面上。 fb-app是该事件的创建者,但我希望自己的个人资料成为创建者,并且我希望它能够在我的Feed上显示。我怎样才能做到这一点?在facebook上发布事件与php的配置文件
$token = file_get_contents('https://graph.facebook.com/oauth/access_token?type=client_cred&client_id=MY_CLIENT_ID&client_secret=MY_CLIENT_SECRET');
$ch=curl_init('https://graph.facebook.com/MY_PROFILE_ID/events');
curl_setopt($ch, CURLOPT_POSTFIELDS, "name=test event&start_time=2011-07-16T19:20&location=someplace&".$token."");
curl_exec($ch);
curl_close($ch);
答
我使用PHP SDK ...
$eventInfo = array(
'name' => 'name',
'description' => strip_tags('description'),
'owner' => 'Owner',
'location' => 'Location name and street',
'city' => 'city',
'start_time' => 'starttime',
'end_time' => 'endtime',
'privacy_type' => 'OPEN'
);
$microFlyerBig = 'http://www.example.com/www/img/img.jpg';
$eventInfo[basename($microFlyerBig)] = "@" . realpath($microFlyerBig);
$fbEventId = $facebook->api("/me/events", "post", $eventInfo);
$fbEventId = $fbEventId['id'];
你不能使用PHP SDK和发送从SDK的要求?几个小时前我使用SDK获得了它的工作,很好。 – 2011-06-17 02:07:15
谢谢facebook PHP SDK对我来说非常好! – waterschaats 2011-06-17 11:45:55