如何使用 OpenSocial 客户端库获取 MySpace 个人资料信息?

发布于 2024-08-08 05:24:24 字数 133 浏览 8 评论 0原文

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

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

谢谢。

Any advice on how to get MySpace or Orkut info such as birthdate from a person's profile using OAuth using the OpenSocial PHP Client library?

I am lost on the process, and the tutorials are complicated. Any simple code would be helpful!

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

眼中杀气 2024-08-15 05:24:24

首先,您需要 PHP 开放社交客户端

文档中所示,您需要创建一个 < a href="http://code.google.com/p/opensocial-php-client/wiki/HowToConnecting" rel="nofollow noreferrer">osapi 容器,它需要提供者和授权对象。对于 MySpace,它看起来像:

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

恐怕我不知道 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');

First, you need the PHP Open Social Client.

As shown in the documentation, you will need to create an osapi container, which requires a provider and an authorization object. In the case of MySpace, it would look something like:

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

I'm afraid I have no idea what goes in the auth area, whether it's those actual strings or something that you should already know. I'm sure the page I got it from has more info. But either way, once you have the osapi container, you can then make requests for user info:

   $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');
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文