ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/facebook/trunk/test
Revision: 946
Committed: 2007-08-29T21:28:44-07:00 (17 years, 9 months ago) by douglas
File size: 1215 byte(s)
Log Message:
It would seem that this works!

File Contents

# Content
1 #!/usr/bin/env php
2 <?php # $Id$
3 $dir = realpath(dirname(__FILE__));
4 $file = fopen("$dir/.facebook_key", 'r');
5
6 fscanf($file, '%s\n', $api_key);
7 fscanf($file, '%s\n', $secret);
8 fclose($file);
9
10 require_once 'facebook_desktop.php';
11
12 $facebook = new FacebookDesktop($api_key, $secret);
13
14 $file = fopen("$dir/.facebook_session_key", 'r');
15
16 fscanf($file, '%s\n', $session_key);
17 fscanf($file, '%s\n', $secret);
18 fclose($file);
19
20 $uid = preg_replace('/^[a-z0-9]+-/', '', $session_key);
21
22 $facebook->set_user($uid, $session_key);
23 $facebook->set_session_secret($secret);
24
25 $calls = array(
26 'fql_query("select sex, birthday from user where uid = $uid")',
27 #'friends_get()',
28 #'friends_getAppUsers()',
29 #'profile_getFBML("")',
30 #'users_getInfo(array($uid), array("about_me", "affiliations"))',
31 'users_getLoggedInUser()'
32 );
33
34 foreach ($calls as $call)
35 {
36 $facebook->api_client->json = 0;
37
38 for ($json = &$facebook->api_client->json; $json != 2; ++$json)
39 {
40 try
41 {
42 $value = eval("return \$facebook->api_client->$call;");
43 }
44 catch (FacebookRestClientException $exception)
45 {
46 $value = $exception;
47 }
48
49 if ($json)
50 echo 'JSON ';
51 else
52 echo 'XML ';
53
54 print_r($value);
55
56 if (is_scalar($value))
57 echo "\n";
58 }
59 }

Properties

Name Value
svn:executable *
svn:keywords Id