私はレシピ付きのサイトを持っており、そのサイトには数千人の友人がいる Facebook のグループもあります。グループのタイムラインに新しいレシピを投稿したい。たとえば、1時間ごとにcronで実行できます。
require_once('facebook.php');
$config = array(
'appId' => 'xxx',
'secret' => 'xxx',
);
$facebook = new Facebook($config);
// If not, we'll get an exception, which we handle below.
try {
$ret_obj = $facebook->api('/page_id/feed', 'POST',
array(
'link' => 'www.example.com',
'message' => 'Posting with the PHP SDK!'
));
echo '<pre>Post ID: ' . $ret_obj['id'] . '</pre>';
} catch(FacebookApiException $e) {
echo "error type: ". $e->getType()."<br />";
echo "error mesage: ". $e->getMessage()."<br />";
}
cron デーモンからグループ ページに投稿できるようにスクリプトを変更するにはどうすればよいですか?
スクリプトを少し変更したところ、次のエラーが発生しました: error type: OAuthException error message: (#200) The user has not Authorized the application to perform this action