*/ // get current session id $session_id = session_id(); // enable osapi logging to file osapiLogger::setLevel(osapiLogger::INFO); osapiLogger::setAppender(new osapiFileAppender(sys_get_temp_dir() . '/opensocial.log')); // create yahoo open social provider $provider = new osapiYahooProvider(); // create file system storage using system temp directory $storage = new osapiFileStorage(sys_get_temp_dir()); // if this is a YAP application, the access token and secret // will be provided. if (isset($_POST['yap_viewer_access_token']) && isset($_POST['yap_viewer_access_token_secret']) && isset($_POST['yap_viewer_guid'])) { $oauth = new osapiOAuth3Legged(OAUTH_CONSUMER_KEY, OAUTH_CONSUMER_SECRET, $storage, $provider, $_POST['yap_viewer_guid'], $_POST['yap_viewer_guid'], $_POST['yap_viewer_access_token'], $_POST['yap_viewer_access_token_secret']); } else { $oauth = osapiOAuth3Legged::performOAuthLogin(OAUTH_CONSUMER_KEY, OAUTH_CONSUMER_SECRET, $storage, $provider, $session_id); } // create open social instance from yahoo provider + oauth credentials $opensocial = new osapi($provider, $oauth); // The number of friends to fetch. $friend_count = 10; // Start a batch so that many requests may be made at once. $batch = $opensocial->newBatch(); // Fetch the user profile $batch->add($opensocial->people->get(array('userId' => '@me', 'groupId' => '@self', 'fields' => array('displayName'))), 'self'); // Fetch the friends of the user $batch->add($opensocial->people->get(array('userId' => '@me', 'groupId' => '@friends', 'fields' => array('id'), 'count' => 100)), 'friends'); // Request the activities of the current user $batch->add($opensocial->activities->get(array('userId' => '@me', 'groupId' => '@self', 'count' => 100)), 'userActivities'); // Send the batch request $result = $batch->execute();
case 'myspace': $userId = '495184236'; $osapi = new osapi(new osapiMySpaceProvider(), new osapiOAuth2Legged("http://www.myspace.com/495182150", "20ab52223e684594a8050a8bfd4b06693ba9c9183ee24e1987be87746b1b03f8", $userId)); break; case 'myspaceid': // NOTE: to authorize using 3leggedOAuth & MySpace your app MUST be a MySpaceID app otherwise use 2LeggedOAuth $provider = new osapiMySpaceProvider(); $storage = new osapiFileStorage('/tmp/osapi'); $auth = osapiOAuth3Legged::performOAuthLogin('6043e2bda2e546498928732c01982b24', '14d70750b3ae45c1b8c8b834f145aa3fa632013885964cf6bd41792d51754810', $storage, $provider, $localUserId); $osapi = new osapi($provider, $auth); break; case 'google3legged': // See http://code.google.com/apis/accounts/docs/OAuthForInstalledApps.html for information about the key/secret $provider = new osapiGoogleProvider(); $storage = new osapiFileStorage('/tmp/osapi'); $auth = osapiOAuth3Legged::performOAuthLogin('anonymous', 'anonymous', $storage, $provider, $localUserId); $osapi = new osapi($provider, $auth); break; case 'google2legged': $userId = '101911127807751034357'; $provider = new osapiGoogleProvider(); $provider->rpcEndpoint = null; $osapi = new osapi($provider, new osapiOAuth2Legged("google.com:249475676706", "fWPcoVP6DOLVqZOF2HH+ihU2", $userId)); break; } $script_name = $_SERVER["SCRIPT_NAME"]; $tests = array("google2legged" => "Google (2 legged)", "google3legged" => "Google (3 legged)", "myspace" => "MySpace", "myspaceid" => "MySpaceID", "orkut" => "orkut", "orkutRest" => "orkut (REST)", "partuza" => "Partuza", "partuzaLocal" => "partuzaLocal", "partuzaLocalRest" => "partuzaLocalRest", "plaxo" => "Plaxo", "netlog" => 'Netlog', 'hi5' => 'Hi5'); $links = array(); foreach ($tests as $value => $name) { if ($value == $test) { $links[] = "<strong>{$name}</strong>";