0
在我搜索如何發佈數據到Facebook頁面後,現在我可以做得很好。將數據發佈到沒有用戶交互的Facebook頁面
<?php
// Remember to copy files from the SDK's src/ directory to a
// directory in your application on the server, such as php-sdk/
require '../src/facebook.php';
$facebook = new Facebook(array(
'appId' => '491652477512398',
'secret' => 'de3d98a619ade1afb4152d6be90acdb9',
));
$user_id = $facebook->getUser();
echo "User data ".$user_id." \n";
try {
if($user_id) {
$ret_obj = $facebook->api('/microdigit.it/feed/', 'POST',
array(
//'access_token' => 'AAACEdEose0cBAExkj6B4lnjpUtfSSVTOZA9CuvMA1SDjyCQWRnfZCbc1SimyRsZCTa6CUFZB2Q3ZBfVIv0qJmW13XkPZASpt9UDE4qQI488mDqlznDZA2ih',
'message' => '*** Microdigit Microdigit 000 ****',
'name' => 'name 777 after log out test',
'caption' => 'this is caption for action link',
'description' => 'here goes description and links http:anotherfeed.com | http://facebook.com/anotherfeed',
'picture' => 'http://www.google.com/tv/images/slivetv.png',
'link' => 'www.yahoo.com',
'properties' => array(
array('text' => 'test link 1', 'href' => 'http://anotherfeed.com/?ref=1'),
array('text' => 'test link 1', 'href' => 'http://anotherfeed.com/?ref=1'),
),
));
echo '<pre>Post ID: ' . $ret_obj['id'] . '</pre>';
}else
{
$login_url = $facebook->getLoginUrl(array('scope' => 'offline_access,publish_stream'));
echo 'Please <a href="' . $login_url . '">login.</a>';
}
} catch(FacebookApiException $e) {
echo $e;
$login_url = $facebook->getLoginUrl(array(
'scope' => 'offline_access,publish_stream'
));
echo 'Please <a href="' . $login_url . '">login.</a>';
error_log($e->getType());
error_log($e->getMessage());
}
?>
但問題是我要發佈
該信息頁面,而無需任何用戶交互。
我的意思是每當我運行這段代碼時,如果用戶已經註銷,
我的程序在發佈到Facebook頁面之前需要用戶交互(例如登錄Facebook)。
所以,我會很感激每一個建議,可以告訴我如何發佈數據到Facebook,而無需任何用戶交互。