我從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歲的尖叫。 –