在 php 中检索 Messenger(windows live)上的用户配置文件连接 sdk [英] Retrieving user profile on messenger(windows live) connect sdk within php

查看:56
本文介绍了在 php 中检索 Messenger(windows live)上的用户配置文件连接 sdk的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用此示例在 windows live 平台上成功建立登录连接:
http://code.msdn.microsoft.com/messengerconnect(oauth 处理程序回调一)

I am using this example to successfuly make a login connection on windows live platform:
http://code.msdn.microsoft.com/messengerconnect (the oauth handler callback one)

我从他们的 api 收到一个令牌和一个用户 ID,但我似乎无法理解如何从这些信息中获取用户个人资料.
有人知道怎么做吗?
MS 网站上有例子,但都是 C# 或 javascript 的,我必须用 PHP 来做.

I receive a token and a user id from their api, but I can't seem to understand how to fetch the user profile from these info.
Does anyone know how to do this?
There are examples in MS website, but they are all C# or javascript ones and I have to do it in PHP.

在检索令牌和 cid 后,我尝试了此操作,但返回一个错误:

After retrieving the token and the cid I tried this, but returns me an error:

$url_string = 'http://apis.live.net/V4.1/cid-'.$user->getId().'/Profiles/';
echo("<br/>\n".$url_string);
$curl_session = curl_init($url_string);

// build HTTP header with authorization code
$curl_options = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array(
  'Authorization: WRAP access_token=AuthToken="'.urlencode($_REQUEST['stoken']).'"',
  'Accept: application/json'
  )
);

// setup options for curl transfer
curl_setopt_array($curl_session, $curl_options);

// execute session and get response
$curl_response = curl_exec($curl_session);

print $curl_response;

curl_close($curl_session);

错误是这样的:
{"Title":"ErrorResource","Code":1062,"Message":"请求不包含有效的 PUID."}

The error is this:
{"Title":"ErrorResource","Code":1062,"Message":"Request does not contain a valid PUID."}

你们能帮我检索用户信息吗?

can you guys help me retrieving the user info?


通过从授权中删除 =AuthToken 解决了这个问题并且它起作用了!


solved the problem by removing the =AuthToken from the authorization and it worked!

谢谢,

推荐答案

是的!

在数小时后尝试了 ms 中的大量不同样本,使其工作正常 ¬¬

made it work after hours trying lots of differents samples from ms ¬¬

问题是授权:WRAP access_token=AuthToken=

the problem was the Authorization: WRAP access_token=AuthToken=

刚刚删除了 AuthToken= 并且它起作用了!

just removed the AuthToken= and it worked!

所以现在是这样的:
'授权:WRAP access_token="'.$wrapper->getReturnedParameter('wrap_access_token').'"'

so its now like this:
'Authorization: WRAP access_token="'.$wrapper->getReturnedParameter('wrap_access_token').'"'

这篇关于在 php 中检索 Messenger(windows live)上的用户配置文件连接 sdk的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆