<?php
function get_qq_level($qq, $skey, $p_skey, $targetUin) {
$url = 'https://h5.vip.qq.com/p/mc/cardv2/other?qq=' . $targetUin;
$cookie = 'p_uin=o' . $qq . '; uin=o' . $qq . '; skey=' . $skey . '; p_skey=' . $p_skey;
$options = [
'http' => [
'method' => 'GET',
'header' => [
"User-Agent: Mozilla/5.0 (Linux; Android 10; HLK-AL00 Build/HONORHLK-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/78.0.3904.108 Safari/537.36 V1_AND_SQ_8.4.5_1468_YYB_D QQ/8.4.5.4745 NetType/4G WebP/0.4.1 Pixel/1080 StatusBarHeight/51 SimpleUISwitch/0 QQTheme/1000 InMagicWin/0",
"Cookie: $cookie",
"Referer: https://h5.vip.qq.com"
],
'timeout' => 30
]
];
$context = stream_context_create($options);
$data = file_get_contents($url, false, $context);
preg_match('/<p><small>LV<\/small>(.*?)<\/p>/', $data, $matches);
return [
'code' => 1,
'level' => $matches[1]
];
}
$result = get_qq_level('123456', 'skey', 'p_skey', '1234567');
print_r($result);