0

picture特定の Facebook ページのオブジェクトを購読したい。そのために、私はこの記事に従っています。ここにコールバックとなる PHP ファイルをアップロードしました。以下のコード:

<?php                                    
/**
 * This is sample subscription endpoint for using Facebook real-time update
 * See http://developers.facebook.com/docs/api/realtime to additional
 * documentation
 */

// Please make sure to REPLACE the value of VERIFY_TOKEN 'abc' with 
// your own secret string. This is the value to pass to Facebook 
//  when add/modify this subscription.
define('VERIFY_TOKEN', 'app_code_123');                                    
$method = $_SERVER['REQUEST_METHOD'];                             

// In PHP, dots and spaces in query parameter names are converted to 
// underscores automatically. So we need to check "hub_mode" instead
//  of "hub.mode".                                                      
if ($method == 'GET' && $_GET['hub_mode'] == 'subscribe' &&       
    $_GET['hub_verify_token'] == VERIFY_TOKEN) {
  echo $_GET['hub_challenge'];
} else if ($method == 'POST') {                                   
  $updates = json_decode(file_get_contents("php://input"), true); 
  // Replace with your own code here to handle the update 
  // Note the request must complete within 15 seconds.
  // Otherwise Facebook server will consider it a timeout and 
  // resend the push notification again.
  error_log('updates = ' . print_r($updates, true));              
}
?>

次に、アプリの詳細から とをaccess_token置き換えた記事の指示どおりに取得しました。client_idAPP_IDclient_secretAPP SECREThttps://graph.facebook.com/oauth/access_token?grant_type=client_credentials&client_id=<REMOVED APP ID>&client_secret=<REMOVED CLIENT SECRET>

続いて、サブスクリプションを作成しようとします: https://graph.facebook.com/<REMOVED APP ID>/subscriptions?access_token=<REMOVED APP ACCESS TOKEN>object=user&fields=feed&verify_token=app_code_123&method=post&callback_url=http://www.shameemcompany.com/facebook.php

しかし、それはエラーで失敗します:

"message": "(#2200) callback verification failed: ",
      "type": "OAuthException",
      "code": 2200

特定の Facebook ページを購読したいのですが、どこで、またはどのように指定すればよいですか?

4

1 に答える 1

0

まず、「..&method=POST&..」を送信する代わりに、HTTP POST メソッドを使用する必要があります。

次に、サーバーはインターネットからアクセスできる必要があります。

そして 3 つ目は、Facebook が検証要求を同時に送信するため、サーバーは同時要求を処理できる必要があります。

于 2014-05-26T13:27:56.727 に答える