我正在尝试发布到一些用户墙,我有所需的权限,但是,一些令牌是无效的,有些人只授权了 oauth 的第一步,而不是发布流,所以我得到了一堆错误,这个是代码:
$config = array(
'appId' => APP_ID,
'secret' => APP_SECRET,
'cookie' => false,
);
$facebook = new Facebook($config);
$query = "SELECT * FROM `facebook-users` WHERE NOT token = '';";
$result = mysqli_query($con, $query);
while ($row = mysqli_fetch_array($result)) {
// success
if (!empty($row['token'])) {
$attachment = array(
'access_token' => $row['token'],
'message' => $message,
'name' => $title,
'link' => $link,
'description' => $desc,
'picture'=>$pic,
'actions' => json_encode(array('name' => $action_name,'link' => $action_link))
);
$post_url = '/' . $row['uid'].'/feed';
$status = $facebook->api($post_url, "post", $attachment);
$count++;
}
echo $count;
die();
?>
那么我如何对这些基本错误进行错误检查,并在它们发生时继续?