PHP Facebook Application jSON issue
I am developing a Facebook Application in which I need to view the user_work_history data of a profile. Im doing this in PHP, and Facebook's Documentation is very cryptic and terrible.
In the documentation (http://developers.facebook.com/docs/reference/api/user/), it says "An array of JSON objects containing employer, location, position, start_date and end_date fields". I 开发者_开发问答assumed I would access this by doing something along the lines of <?php echo $me[work]; ?>
however that only returns "array" in the output.
I've tried various things such as <?php echo $me[work][employer]; ?>
which didn't work either.
Any help would be appreciated and recognized!
Try doing a var_dump($me['work'])
or whatever to get a clearer look into what's inside that variable.
Additionally, you can get your access token by calling $fb_object->getAccessToken();
and use that in this URL: https://graph.facebook.com/me?access_token=<whatever>
. Navigating to that in your browser will show you what data is coming back so you can get a better idea of the formatting.
var_dump
documentation
精彩评论