ユーザーID514559322のユーザーのウォールに投稿する次のコードを取得できません。ただし、$uidの値を文字列'me'に置き換えると、自分のウォールに投稿できます。
<?php
require_once "../src/facebook.php";
$app_id = "my app id";
$app_secret = "my app secret";
$uid = 514559322;
// Init facebook api.
$facebook = new Facebook(array(
'appId' => $app_id,
'secret' => $app_secret,
'cookie' => true
));
// Get the url to redirect for login to facebook
// and request permission to write on the user's wall.
$login_url = $facebook->getLoginUrl(
array('scope' => 'publish_stream')
);
// If not authenticated, redirect to the facebook login dialog.
// The $login_url will take care of redirecting back to us
// after successful login.
if (! $facebook->getUser()) {
echo <<< EOT
<script type="text/javascript">
top.location.href = "$login_url";
</script>;
EOT;
exit;
}
// Do the wall post.
$facebook->api("/$uid/feed", "post", array(
message => "Hello win95",
picture => "http://cdn.papyimg.com/wp-content/uploads/2011/03/Windows-95-500x312.png",
link => "http://en.wikipedia.org/wiki/Windows_95",
name => "Go windows 95",
caption => "Caption - this is the best operating system in the world!"
));
?>
PHPスクリプトがuid514559322でユーザーの壁を投稿できるようにするにはどうすればよいですか?
API呼び出しの周りにtrycatchループを追加した後、次の例外メッセージが表示されます。
OAuthException: (#1) An error occured while creating the share
では、コードのどこに認証情報を提供しますか?または適切な認証トークン?