/** * getUidsFromRequestIds * * Obtain the uids from a gived requestids. * @param array $requestIds * @return array $uids */ public static function getUidsFromRequestIds($requestIds) { $appid = copperConfig::get('appId'); $secret = copperConfig::get('appSecret'); $uids = array(); if (copperUtils::valid($requestIds, false)) { $app_token = file_get_contents('https://graph.facebook.com/oauth/access_token?client_id=' . $appid . '&client_secret=' . $secret . '&grant_type=client_credentials'); //Get application token foreach ($requestIds as $key => $sent) { $request = file_get_contents('https://graph.facebook.com/' . $sent . '?' . $app_token); $request = json_decode($request); $uids[] = $request->to->id; } } return $uids; }
echo copperConfig::get('callbackUrl'); ?> '; var CANVAS_URL = '<?php echo copperConfig::get('canvasUrl'); ?> '; <?php if (copperConfig::get('facebookActivate')) { ?> var SIGNED_REQUEST = '<?php echo htmlentities($_REQUEST['signed_request']); ?> '; <?php } ?> </script> <?php $fbInstance = copperConfig::get('fbInstance'); if (!empty($fbInstance)) { try { $friends = $fbInstance->facebook->api('/me/friends'); } catch (Exception $exc) { copperConfig::doError("Error al intentrar inicializar el /me/ : " . $exc->getMessage()); copperConfig::doError("Error al intentrar inicializar el /me/ con trace: " . $exc->getTraceAsString()); } if (!empty($friends)) { copperUtils::setJsVars('myFriends', $friends); } }