开发者

How to get MySpace profile info using OpenSocial client library?

开发者 https://www.devze.com 2022-12-08 21:08 出处:网络
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?

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 开发者_JAVA百科the process, and the tutorials are complicated. Any simple code would be helpful!

Thanks.


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');


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号