2013-08-10 3 views
0

picture 특정 Facebook 페이지의 개체에 가입하고자합니다. 그것을하기 위해서 나는 이것을 따라 가고있다. article. 콜백 here 역할을하는 PHP 파일을 업로드했습니다. 코드 아래 : 다음Facebook 2200 콜백 확인이 실패했습니다.

<?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 내 응용 프로그램의 세부 사항에서 APP SECRETAPP_IDclient_secretclient_id을 대체 문서에서 지시하는대로 : 구독을 생성하기위한 시도로 이어 https://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 페이지를 구독하고 싶은데 어디서 어떻게 지정해야합니까?

+0

[문서] (https://developers.facebook.com/docs/reference/api/realtime/)을 읽었습니까? Facebook이 콜백 URL에 대한 확인 요청을 할 때 콜백이 확실히'hub.challenge'로 응답합니까? – Igy

+0

@ 아이고 모르겠다. 나는 튜토리얼을 정확히 따라 갔다. 'hub.challenge'에 대해서는 언급하지 않았다. 그것이 맞는지 아닌지 나는 어떻게 결정할 것인가? – lbrahim

+0

'Subscription Verification'이라고 표시된 부분을 특별히 언급하고 있습니다.이 부분이 올바르게 발생했는지 확인 했습니까? – Igy

답변

0

먼저 보내는 대신 HTTP POST 메서드를 사용해야합니다 ".. & 방법 = POST &을 ..."

둘째, 서버는 인터넷에서 접근해야합니다.

세 번째로 facebook이 확인 요청을 동시에 전송하기 때문에 서버가 동시 요청을 처리 할 수 ​​있어야합니다.