0

有关如何使用 OpenSocial PHP 客户端库使用 OAuth 从个人资料中获取 MySpace 或 Orkut 信息(例如生日)的任何建议?

我迷失了这个过程,教程很复杂。任何简单的代码都会有所帮助!

谢谢。

4

2 回答 2

1

首先,您需要PHP Open Social Client

文档所示,您将需要创建一个osapi容器,该容器需要提供者和授权对象。在 MySpace 的情况下,它看起来像:

$provider = new osapiMySpaceProvider();
$auth = new osapiOAuth2Legged("<consumer key>", "<consumer secret>", "<OpenSocial user ID>");
$osapi = new osapi($provider, $auth);

恐怕我不知道身份验证区域中发生了什么,无论是那些实际的字符串还是您应该已经知道的东西。我确定我从中获得它的页面有更多信息。但无论哪种方式,一旦你有了osapi容器,你就可以请求用户信息

   $profile_fields = array(
        'aboutMe',
        'displayName',
        'bodyType',
        'currentLocation',
        'drinker',
        'happiestWhen',
        'lookingFor'
    );

$self_request_params = array(
      'userId' => $userId,              // Person we are fetching.
      'groupId' => '@self',             // @self for one person.
      'fields' => $profile_fields       // Which profile fields to request.
  );

$result = $osapi->people->get($self_request_params), 'self');
于 2009-10-21T07:58:37.643 回答
1

Here's a nice tutorial: http://wiki.opensocial.org/index.php?title=Social_Website_Tutorial

于 2010-03-16T22:55:00.273 回答