Last active
January 11, 2017 05:09
-
-
Save ducan-ne/0ef22255b89754369fe08e8dfe6b1591 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
const _TOKEN = '<MY TOKEN>'; | |
$response = _GRAPH('/364997627165697/feed/',array('limit' => 30, 'fields' => 'id')); | |
array_walk($response['data'], function(&$data) use($GLOBALS){ | |
extract($data); | |
if((time() - strtotime($updated_time)) > 5 * 60){ // 5 = 5 minute | |
return $data = [ | |
'liked' => _GRAPH("/{$id}/likes/",array('method' => 'POST')) | |
// _GRAPH("/{$data->id}/sharedposts/",array('method' => 'POST', 'privacy' => json_encode(["value" => "SELF"]))) | |
]; | |
}else{ | |
return []; | |
} | |
}); | |
print_r($response); | |
function _GRAPH($path,$params){ | |
return json_decode(@file_get_contents('https://graph.facebook.com'.$path.'?'.http_build_query(array_merge($params,array('access_token' => constant('_TOKEN'))))),true); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment