我从Facebook获取示例代码以发布消息。起初它工作正常。第二天我试图清理代码并停止工作。我带回了Facebook上的示例代码,将我所做的所有更改都拿出来了,但仍然无法使用。Facebook状态更新代码无法更新墙壁
我把打印语句放在代码后面。
$user_id
是错误的,所以它显示登录。登录不再进入屏幕登录。它会调用我的返回URL,然后将$user_id
视为错误,并再次登录。
我没有通知我的回调正在调用的时候,我有以下值:
v =状态452c9492a3d51962909f5e000bcb0965
和代码
码= AQDucDgsdc3lZFVN2MC3Oj2oB0n1LT4FjOrG3MbgwL4uhh- -LS-mRdtjU-6oSUZxsR6UhTKuUDVn3hrasJAe5r1I6ksIDJz1nnTo1mjCqEInJKvQ2qK5A-N3_Nt5buGLqsirb8ccg21N4nWVWkk_iRePwX9f68qK1j-2O6E_USpKvRJeNP3bcwLBiTBJpDVu7aA#=
我在想,也许当我试图清理代码,并不停地运行它,Facebook的标记我的应用程序为垃圾邮件?我张贴了26篇文章到我的墙上 - 这太多了吗?如何检查我的应用是否被标记为垃圾邮件应用?
这是我用
<?
// Remember to copy files from the SDK's src/ directory to a
// directory in your application on the server, such as php-sdk/
require_once('facebook.php');
$config = array(
'appId' => 'myappid',
'secret' => 'mysecret',
);
$facebook = new Facebook($config);
$user_id = $facebook->getUser();
?>
<html>
<head></head>
<body>
<?
if($user_id) {
print ("tryinmg to do a poast");
// We have a user ID, so probably a logged in user.
// If not, we'll get an exception, which we handle below.
try {
$ret_obj = $facebook->api('/me/feed', 'POST',
array(
'link' => 'www.example.com',
'message' => 'Posting with the PHP SDK!'
));
echo '<pre>Post ID: ' . $ret_obj['id'] . '</pre>';
} catch(FacebookApiException $e) {
// If the user is logged out, you can have a
// user ID even though the access token is invalid.
// In this case, we'll get an exception, so we'll
// just ask the user to login again here.
print ("face book exception log in");
$login_url = $facebook->getLoginUrl(array(
'scope' => 'publish_stream'
));
echo 'Please <a href="' . $login_url . '">login.</a>';
error_log($e->getType());
error_log($e->getMessage());
}
// Give the user a logout link
echo '<br /><a href="' . $facebook->getLogoutUrl() . '">logout</a>';
} else {
print ("no user login in do login");
// No user, so print a link for the user to login
// To post to a user's wall, we need publish_stream permission
// We'll use the current URL as the redirect_uri, so we don't
// need to specify it here
$login_url = $facebook->getLoginUrl(array('scope' => 'publish_stream'));
echo 'Please <a href="' . $login_url . '">login.</a>';
}
?>
</body>
</html>
没有任何编辑将使我能够理解这个问题。 – doctorless
-1完全无法理解,标题听起来像是一个2岁的尖叫。 –