目前正在使用Runkeeper api工作,但正在运行(haha)一些关于我需要在orde中完成对该事物进行授权的帖子请求的问题。
我目前使用此代码:
$grant_type ='authorization_code';
$code = $codeR;
$client_id = $this->client_id;
$client_secret = $this->client_secret;
$redirect_uri = $this->req_url;
$url = 'http://api.runkeeper.com';
$data = array('grant_type' => $grant_type, 'code' => $code, 'client_id' => $client_id, 'client_secret' => $client_secret, 'redirect_url' => $redirect_uri);
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url,false,'',$options);
return $result;
在将用户重定向到盛大权限后,会成功收到codeR参数。
任何可以提供帮助的人?
谢谢!