跳转QQ名片API源码

某些人QQ号设置无法搜索时,我们正常在QQ里搜索是找不到的所以写一下跳转qq名片的api,自行去搭建(把代码保存为 api.php 文件) 搭建后 域名: api.php?qq= QQ号 然后打开链接,就会自动跳转到关闭搜索的QQ啦!

<?php
header('Content-Type:application/json; charset=utf-8');
$agent = strtolower($_SERVER['HTTP_USER_AGENT']);
//url 参数 ?qq=123456789
$qq = isset($_GET['qq']) ? $_GET['qq'] : "";
if(empty($qq)) {
    echo json_encode(array('code'=>201,'msg'=>'QQ不能为空'),480);
}
if(!preg_match("/^[1-9]\d{4,10}$/",$qq)){
  echo json_encode(array('code'=>202,'msg'=>'QQ格式不正确'),480);
}
if(strpos($agent,'windows nt')){
    $data = "tencent://ContactInfo/?subcmd=ViewInfo&puin=0&uin=$qq";
}
if(strpos($agent,'iphone')){
  $data = "mqq://im/chat?chat_type=wpa&uin=$qq&version=1&src_type=web";
}
if(strpos($agent,'android')){
    $data = "mqq://card/show_pslcard?src_type=internal&version=1&uin=$qq&card_type=person&source=sharecard";
}
if(!empty($data)){
    header("Location:$data");
    exit;
}
© 版权声明
THE END
喜欢就支持一下吧
点赞15 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容