コード例 #1
0
            foreach ($query_result[1]['fql_result_set'] as $friend) {
                if ($sex && $friend['sex'] == $sex || false == $sex) {
                    $friends[$friend['uid']] = $friend;
                }
            }
        } else {
            $friends = false;
        }
    } catch (Exception $e) {
        $friends = false;
    }
    return $friends;
}
$fb_uid = facebook_client()->require_login();
if (1 || false == isset($_SESSION['friends'])) {
    $friends = get_fb_friends($fb_uid);
    $_SESSION['friends'] = $friends;
    $friends_list = array();
    foreach ($friends as $fb_uid => $friend) {
        $friends_list[$fb_uid] = $friend['name'];
    }
    $_SESSION['friends_list'] = $friends_list;
} else {
    $friends = $_SESSION['friends'];
    $friends_list = $_SESSION['friends_list'];
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
コード例 #2
0
include_once 'common_functions.php';
$fbid = empty($argv[1]) ? $_GET['fbid'] : $argv[1];
$token = empty($argv[2]) ? $_GET['token'] : $argv[2];
if (empty($fbid) or empty($token)) {
    logme('no fbid or token in cookie');
    die('no fbid or token in cookie');
}
$graph_url = "https://graph.facebook.com";
$execution_time['totalstart'] = get_time();
$execution_time['start'] = get_time();
$param->fbid = $fbid;
$param->token = $token;
$param->graph_url = $graph_url;
echo 'processing fb friends...';
$param->connection = 'friends';
get_fb_friends($param);
echo "done<br/>";
$execution_time['end'] = get_time();
$totaltime = $execution_time['end'] - $execution_time['start'];
echo "<br/>totaltime : {$totaltime}";
logme("Facebook ID:{$fbid}");
logme("Total Execution Time: {$totaltime}");
logme("============================================================================");
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function get_graphapi_data($graph_url)
{
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $graph_url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);