PHP对接网络游戏防沉迷实名认证系统

PHP对接网络游戏防沉迷实名认证系统

本次开发是自己结合他人的经验开发,但是源文章找不到了,所以自己写了一篇,直接上代码

<?php

namespace Handlers;

class NetworkRealname {

    protected $biz_id;
    protected $app_id;
    protected $secret_key;

    public function __construct()
    {
        $this->biz_id = "";
        $this->app_id = "";
        $this->secret_key = "";
    }

    /*
     * 请求身份验证接口
     * $name 姓名,$card 身份证号,$member_id 平台用户id,$test_code 测试码
     */
    function getIdCard($name,$card,$member_id,$test_code='')
    {
        $timestamps = $this->getMillisecond();    //当前毫秒时间戳
        $url = 'https://api.wlc.nppa.gov.cn/idcard/authentication/check';
        if($test_code) {
            $this->secret_key = 'caebad8c543aa2154b325f9831baa';    //测试secret_key
            $this->app_id = '36fce80d09454712bbb0a7c52ec16';         //测试appId
            $this->biz_id = '1101999999';                               //测试bizId
            $url = 'https://wlc.nppa.gov.cn/test/collection/loginout/'.$test_code;
        }
        $head = ['appId'=>$this->app_id,'bizId'=>$this->biz_id,'timestamps'=>$timestamps];
        //请求头
        $header[] = 'Content-Type:application/json;charset=utf-8';
        $header[] = 'appId:' . $this->app_id;
        $header[] = 'bizId:' . $this->biz_id;
        $header[] = 'timestamps:' . $timestamps;
        //请求体
        $body['ai']    = m
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值