Created
September 27, 2011 19:53
-
-
Save caefer/1246045 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function swap_access_token_for_page($access_token, $page_id) | |
| { | |
| $accounts = file_get_contents('https://graph.facebook.com/me/accounts?access_token='.$access_token); | |
| $accounts = json_decode($accounts, true); | |
| if (isset($accounts['data'])) { | |
| foreach ($accounts['data'] as $account) { | |
| if ($page_id == $account['id']) { | |
| return $account['access_token']; | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment