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());
}
}
無論如何,當我運行此代碼時,什麼都沒有發生?請告訴我,如果我錯了某處或者我缺少某些東西