我想将 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());
}
}
无论如何,当我运行此代码时,什么都没有发生?请告诉我我是否在某个地方错了,或者我是否遗漏了什么