2
我想将Facebook的开放图形功能添加到我的网站。我已经创建了一个动作(watch) a (video)
。此外,我已经建立了我的meta标签,像这样:Facebook PHP发布手表动作
<meta property="og:title" content="title"/>
<meta property="og:type" content="namespace:video"/>
<meta property="og:url" content="http://www.zzz.com/images.php?i=something"/>
<meta property="og:image" content="http://www.zzz.com/thumbnails/images.png"/>
<meta property="og:site_name" content="site name"/>
<meta property="fb:app_id" content="xxxxxxxxxxx"/>
<meta property="fb:admins" content="xxxxxxxxxxxx"/>
<meta property="og:description" content="desc"/>
我使用PHP SDK的视频页面上进行身份验证的用户,现在我要发布的用户行为,像这样:
require_once('scripts/facebook.php');
$config = array('appId' => 'xxxxxx','secret' => 'xxxxxxx');
$facebook = new Facebook($config);
$facebook_user = $facebook->getUser();
$facebook_message = array('message'=>$image_caption, 'link'=>'www.zzz.com/videos.php?i='.$video_name.'');
if($facebook->getUser()){
try{
$access_token = $facebook->getAccessToken();
$params = array('video'=>'http://www.zzz.com/','access_token'=>$access_token);
$publish = $facebook->api('/me/namespace:watch','post',$params);
}catch(FacebookApiException $e) {
error_log($e->getType());
error_log($e->getMessage());
}
}
无论如何,当我运行此代码时,什么都没有发生?请告诉我,如果我错了某处或者我缺少某些东西