0
我的問題很簡單。如何張貼在最近的股票和活動,但不是在牆上(時間軸)與PHP。 (發佈操作)。 我在JavaScript中已經做了,但我想它在PHP帖子上的股票和活動最近,但不是在牆上用php
我已經測試這一點:
$params = array(
'message' => "This post is a test",
'name' => "Titre de mon test",
'caption' => "My Caption",
'description' => "Some Description...",
'link' => "http://stackoverflow.com",
'actions' => array('name'=>'Recipe','link'=>'url'),
'picture' => "http://i.imgur.com/VUBz8.png",
);
$post = $facebook->api("/$user/feed","POST",$params);
感謝。
我發現編輯:
我發現
<meta property="og:title" content="My article" />
<meta property="og:type" content="namespace:recipe" />
<meta property="og:url" content="http://url/" />
<meta property="og:image" content="" />
<meta property="fb:app_id" content="apikey" />
<meta property="og:description" content="My wonderful article" />
和PHP
try {
$action = array('name' => 'recipe', 'link' => 'http://url/');
$actions = json_encode($action);
$params = array('recipe'=>'http://url/','access_token'=>$facebook->getAccessToken(), 'actions'=> urlencode($actions));
$out = $facebook->api('/me/namespace:cook','post',$params);
echo "Your post was successfully posted to UID: $user";
}
catch (FacebookApiException $e) {
$result = $e->getResult();
}
}
你是怎麼設法用javascript做到的? –
FB.api( '/ me/namespace:cook', 'post', {recipe:'http:// url'}, 函數(響應){ if(!response || response.error) ('Cook was successful!Action ID:'+ response.id); } });其他{ }其他{ } –