ファン ページに投稿する権限を持つacces_token
とを使用する Graph API コードを使用しています。id_page
ユーザーがログインしている間は機能しますが、ログアウトするとaccess_token
期限切れになり、ファンページに公開できません。
ユーザーがログインしていなくても、いつでもアプリケーションを公開できるようにするにはどうすればよいですか?
これは私のコードです:
<?php
$page_access_token = 'AAAFNxxxx';
$page_id = '15203xxx';
$data['picture'] = "https://www.google.it/logos/2012/moby_dick12-hp.jpg";
$data['link'] = "http://www.google.it/";
$data['message'] = "Test";
$data['description'] = "Lorem ipsum dolor sit amet";
$data['access_token'] = $page_access_token;
//curl connection
$post_url = 'https://graph.facebook.com/'.$page_id.'/feed';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $post_url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$return = curl_exec($ch);
curl_close($ch); ?>