我正在尝试在用户墙上发布照片并标记朋友,但我得到了这个:
致命错误:未捕获的 OAuthException:(#324) 需要在第 1238 行的 /home/vhosts/somesite.com/src/base_facebook.php 中抛出上传文件
这是我的代码
<?php
require_once "./src/facebook.php";
$app_id = "xxxxxxxx";
$app_secret = "xxxxxxxxxx";
// 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')
);
$loginUrl = $facebook->getLoginUrl($params);
// 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.
$args = array(
'message' => 'Test Message',
'image' => '@' . realpath('http://imageurl.com'),
'tags' => array(
array(
'tag_uid'=> $friend1_uid,
'x' => $x1,
'y' => $y1,
),
array(
'tag_uid' => $friend2_uid,
'x' => $x2,
'y' => $y2,
),/*...*/
),
);
$data = $facebook->api('/me/photos', 'post', $args);
// Upload Support.
$facebook = new Facebook(array(
/*..*/
'fileUpload' => true,
));
?>