Skip to content
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.

Commit

Permalink
Feat/bilibili (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
waset authored May 12, 2022
1 parent 996c641 commit 9d376c4
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/Bilibili/User.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace Waset\Bilibili;

class User extends Application
{
/**
* 获取用户公开信息
*
* 调用该接口可获取用户公开信息,例如头像,昵称,openid等
*
* @see https://openhome.bilibili.com/doc/4/feb66f99-7d87-c206-00e7-d84164cd701c
*
* @param string $access_token
* @return User
*/
public function info(string $access_token)
{
$api_url = 'http://member.bilibili.com/arcopen/fn/user/account/info';
$params = [
'access_token' => $access_token,
'client_id' => $this->client_id,
];

$res = $this->https_get($api_url, $params)->toArray();

return $res['data'] ?? throw new \Exception("获取授权信息失败", 1);
}
}

0 comments on commit 9d376c4

Please sign in to comment.