Hoi,

Ik ben momenteel bezig met het programmeren met de Facebook API, en heb hier een vraag over.

Momenteel krijg ik de volgende response:
object(Facebook\FacebookResponse)#66 (6) { ["httpStatusCode":protected]=> int(200) ["headers":protected]=> array(15) { ["x-page-usage"]=> string(49) "{"call_count":1,"total_cputime":1,"total_time":1}" ["Strict-Transport-Security"]=> string(25) "max-age=15552000; preload" ["x-fb-trace-id"]=> string(11) "EDUuvWFDseH" ["x-fb-rev"]=> string(7) "3918072" ["Expires"]=> string(29) "Sat, 01 Jan 2000 00:00:00 GMT" ["Content-Type"]=> string(31) "application/json; charset=UTF-8" ["facebook-api-version"]=> string(4) "v2.9" ["Cache-Control"]=> string(44) "private, no-cache, no-store, must-revalidate" ["Pragma"]=> string(8) "no-cache" ["Access-Control-Allow-Origin"]=> string(1) "*" ["Vary"]=> string(15) "Accept-Encoding" ["X-FB-Debug"]=> string(88) "guQ6PygzUP+E2V4itBh770UTCHmgqthz7Sog9UekKQkzE54w35yvFUz7LULZvBG4rk0brOJFq+/Lw/ikkCg1mbIRw5A==" ["Date"]=> string(29) "Thu, 17 May 2018 17:27:27 GMT" ["Connection"]=> string(10) "keep-alive" ["Content-Length"]=> string(2) "41" } ["body":protected]=> string(41) "{"id":"672066102851684_1815583451833271"}" ["decodedBody":protected]=> array(1) { ["id"]=> string(32) "672066102851684_1815583451833271" } ["request":protected]=> object(Facebook\FacebookRequest)#64 (9) { ["app":protected]=> object(Facebook\FacebookApp)#3 (2) { ["id":protected]=> string(15) "151884498332625" ["secret":protected]=> string(32) "d1d1f0621cdb0aef10a1194edc333122" } ["accessToken":protected]=> string(177) "EAACKI12R69EBAASmRixgyq1ZBNLGeyZBKHeDJ7ZCB3h53542HyMWSqPjaYHzcJCyfWybvIbK4IE423rh5xORU4y1234uBOk9eOfZCt3Jlk3oQzIQEmHjaVzScNPIYvsJdTwxhqEtdbPERxb0uXKMVWDK7SyLaxxLuaHdf8mniFtVf5rebZCZAgZDZD" ["method":protected]=> string(4) "POST" ["endpoint":protected]=> string(21) "/672066102851684/feed" ["headers":protected]=> array(1) { ["Content-Type"]=> string(33) "application/x-www-form-urlencoded" } ["params":protected]=> array(3) { ["link"]=> string(21) "http://www.Google.com" ["name"]=> string(5) "test." ["description"]=> string(5) "test." } ["files":protected]=> array(0) { } ["eTag":protected]=> NULL ["graphVersion":protected]=> string(4) "v2.9" } ["thrownException":protected]=> NULL }


Hoe kan ik de output via PHP zo maken, bijvoorbeeld via json, dat het systeem alleen dit laat zien van bovenstaande code:
672066102851684_1815583451833271
Even een mooi markup-tipje. Zet je result die je krijgt eens in je script tussen <pre> tags van HTML.
Dan zie je een duidelijke boom van array's, en zie je in één oogopslag op welk niveau je moet zoeken.

Reageren