网站地址:网络游戏防沉迷实名认证系统

PHP代码:

创建对应文件,在需要的位置get传参请求即可,具体参数参考 网络游戏防沉迷实名认证系统接口对接技术规范v2.0

1、上传信息

<?php
$url  ="https://wlc.nppa.gov.cn/test/authentication/check";

$config['appid'] = $_GET['appid'];

$config['bizid'] = $_GET['bizid'];

$config['timestamps'] = microsecond();

$config['secretKey'] =  $_GET['secretKey'];

$data['data'] = aesGcm($_GET['data'],$config['secretKey']);

$data = json_encode($data);
$str = $config['secretKey'].'appId'.$config['appid'].'bizId'.$config['bizid'].'timestamps'.$config['timestamps'].$data;

$config['sign'] = hash("sha256", $str);

$return = doHttpPost($url,$data,$config);

echo $return;

function aesGcm($data,$key)
{
        $key = hex2bin($key);
        $cipher = "aes-128-gcm";
        $ivlen = openssl_cipher_iv_length($cipher);
        $iv = openssl_random_pseudo_bytes($ivlen);
        $encrypt = openssl_encrypt($data, $cipher, $key, OPENSSL_RAW_DATA,$iv,$tag);
        return base64_encode(($iv.$encrypt.$tag));
}

function doHttpPost($url, $data,$config, $options &
03-19 19:27