Created
May 10, 2010 09:04
-
-
Save davidrecordon/395844 to your computer and use it in GitHub Desktop.
This file contains 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 | |
// you need an access token, and it might require the user_likes permission. | |
// see http://developers.facebook.com/docs/authentication. Just trying this | |
// out for yourself, grab one of your access tokens from | |
// http://developers.facebook.com/docs/api. | |
$access_token = ''; | |
$user = ''; | |
$api = 'https://graph.facebook.com/'; | |
$data = file_get_contents($api . $user . '/likes?access_token=' . $access_token); | |
$raw_likes = json_decode($data, true); | |
if (!array_key_exists('data', $raw_likes)) { | |
die; | |
} | |
$like_ids = array(); | |
foreach($raw_likes['data'] as $raw_like) { | |
array_push($like_ids, $raw_like['id']); | |
} | |
// this data is public, no SSL or access token required | |
$like_data = file_get_contents('http://graph.facebook.com/?ids=' . implode(",", $like_ids)); | |
$likes = json_decode($like_data, true); | |
foreach($likes as $key => $value) { | |
// we're only interested in things I liked via Social Plugins | |
if (strstr($value['link'], 'http://www.facebook.com/')) { | |
continue; | |
} | |
print_r($value); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment