저는 Facebook의 API를 사용하여 인스턴트 기사를 만드는 WordPress 플러그인을 개발해 왔습니다. (여기서 SDK 버전 5.3.1을 사용하고 있습니다 : https://github.com/facebook/php-graph-sdk/tree/5.4) 많은 사용자 정의 필드가 필요하므로 기존 플러그인을 사용하는 대신 새로운 플러그인을 사용해야합니다. Vagrant/VirtualBox Linux 서버를 사용하여 로컬 컴퓨터에서 개발했으며 게시 도구> 인스턴트 기사> 개발 관련 기사에서 Facebook의 목록에 나타난 Instant Article을 성공적으로 인증하고 만들 수있었습니다.Facebook 인스턴트 기사 : 그래프 API로 기사 만들기
라이브 웹 서버에 동일한 코드를 배포하여 테스트를 계속했습니다. 인증은 성공적이지만 서버에서 기사를 게시하려고 시도하면 Instant Article이 생성되지 않고 Facebook의 목록에 나타나지 않습니다.
수수께끼 같은 것은 두 시도의 응답이 거의 동일하다는 것입니다. 한 가지 차이점은 accessToken 값이며 {access_token}
으로 표시했습니다. 응답 간의 다른 차이점은 {different}
입니다.
PHP와 API 응답에서 명백한 오류없이 성공한 이유와 실패한 이유를 이해할 수있는 사람이 있습니까? 로컬 컴퓨터를 사용하여
응답 (성공) : 라이브 서버를 사용
object(Facebook\FacebookResponse)#144 (6) {
["httpStatusCode":protected]=>
int(200)
["headers":protected]=>
array(13) {
["Access-Control-Allow-Origin"]=>
string(1) "*"
["Pragma"]=>
string(8) "no-cache"
["Cache-Control"]=>
string(44) "private, no-cache, no-store, must-revalidate"
["facebook-api-version"]=>
string(4) "v2.7"
["Expires"]=>
string(29) "Sat, 01 Jan 2000 00:00:00 GMT"
["Content-Type"]=>
string(31) "application/json; charset=UTF-8"
["x-fb-trace-id"]=>
string(11) "{different}"
["x-fb-rev"]=>
string(7) "{different}"
["Vary"]=>
string(15) "Accept-Encoding"
["X-FB-Debug"]=>
string(88) "{different}"
["Date"]=>
string(29) "Wed, 19 Oct 2016 16:24:51 GMT"
["Connection"]=>
string(10) "keep-alive"
["Content-Length"]=>
string(2) "25"
}
["body":protected]=>
string(25) "{"id":"{different}"}"
["decodedBody":protected]=>
array(1) {
["id"]=>
string(16) "{different}"
}
["request":protected]=>
object(Facebook\FacebookRequest)#145 (9) {
["app":protected]=>
object(Facebook\FacebookApp)#183 (2) {
["id":protected]=>
string(16) "{app_id}"
["secret":protected]=>
string(32) "{app_secret}"
}
["accessToken":protected]=>
string(168) "{access_token}"
["method":protected]=>
string(4) "POST"
["endpoint":protected]=>
string(29) "/{some_endpoint_id}/instant_articles"
["headers":protected]=>
array(1) {
["Content-Type"]=>
string(33) "application/x-www-form-urlencoded"
}
["params":protected]=>
array(3) {
["development_mode"]=>
string(1) "1"
["published"]=>
bool(false)
["html_source"]=>
string(1600) "<html> ... </html>"
}
["files":protected]=>
array(0) {
}
["eTag":protected]=>
NULL
["graphVersion":protected]=>
string(4) "v2.7"
}
["thrownException":protected]=>
NULL
}
응답 (실패) :
object(Facebook\FacebookResponse)#107 (6) {
["httpStatusCode":protected]=>
int(200)
["headers":protected]=>
array(13) {
["Access-Control-Allow-Origin"]=>
string(1) "*"
["Pragma"]=>
string(8) "no-cache"
["Cache-Control"]=>
string(44) "private, no-cache, no-store, must-revalidate"
["facebook-api-version"]=>
string(4) "v2.7"
["Expires"]=>
string(29) "Sat, 01 Jan 2000 00:00:00 GMT"
["Content-Type"]=>
string(31) "application/json; charset=UTF-8"
["x-fb-trace-id"]=>
string(11) "{different}"
["x-fb-rev"]=>
string(7) "{different}"
["Vary"]=>
string(15) "Accept-Encoding"
["X-FB-Debug"]=>
string(88) "{different}"
["Date"]=>
string(29) "Wed, 19 Oct 2016 16:02:08 GMT"
["Connection"]=>
string(10) "keep-alive"
["Content-Length"]=>
string(2) "24"
}
["body":protected]=>
string(24) "{"id":"{different}"}"
["decodedBody":protected]=>
array(1) {
["id"]=>
string(15) "{different}"
}
["request":protected]=>
object(Facebook\FacebookRequest)#106 (9) {
["app":protected]=>
object(Facebook\FacebookApp)#126 (2) {
["id":protected]=>
string(16) "{app_id}"
["secret":protected]=>
string(32) "{app_secret}"
}
["accessToken":protected]=>
string(164) "{access_token}"
["method":protected]=>
string(4) "POST"
["endpoint":protected]=>
string(29) "/{some_endpoint_id}/instant_articles"
["headers":protected]=>
array(1) {
["Content-Type"]=>
string(33) "application/x-www-form-urlencoded"
}
["params":protected]=>
array(3) {
["development_mode"]=>
string(1) "1"
["published"]=>
bool(false)
["html_source"]=>
string(1639) "<html> ... </html>"
}
["files":protected]=>
array(0) {
}
["eTag":protected]=>
NULL
["graphVersion":protected]=>
string(4) "v2.7"
}
["thrownException":protected]=>
NULL
}
API를 통해받은 ID에 대한 세부 정보를 요청하면 어떻게됩니까? – CBroe