我想在我的网站上添加Facebook开放图表功能。我已经创建了一个动作(watch) a (video)
。我也设置了我的元标记:
<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());
}
}
无论如何,当我运行此代码时,什么都没发生?请告诉我,如果我在某处错了或者我错过了什么
答案 0 :(得分:1)
您不能再拥有自定义观看操作,您必须使用内置操作。
https://developers.facebook.com/docs/opengraph/actions/builtin/#watch