网站自动更新时间代码网站域名和空间费用
news/
2025/9/23 15:39:00/
文章来源:
网站自动更新时间代码,网站域名和空间费用,seo怎么快速提高排名,微信公众号做视频网站吗网站地址#xff1a;网络游戏防沉迷实名认证系统
PHP代码#xff1a;
创建对应文件#xff0c;在需要的位置get传参请求即可#xff0c;具体参数参考 网络游戏防沉迷实名认证系统接口对接技术规范v2.0
1、上传信息
?php
$url https://wlc.nppa.gov.cn/test…网站地址网络游戏防沉迷实名认证系统
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 null)
{$headerArray array(Content-Type:application/json;charsetutf-8,appId:.$config[appid],bizId:.$config[bizid],timestamps:.$config[timestamps],sign:.$config[sign]);//$header array(Content-Typeapplication/json;charsetutf-8,appId$config[appid],bizId$config[bizid],timestamps$config[timestamps],sign$config[sign]);$curl curl_init();curl_setopt($curl, CURLOPT_URL, $url);curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,FALSE);curl_setopt($curl, CURLOPT_POST, 1);curl_setopt($curl, CURLOPT_POSTFIELDS, $data);curl_setopt($curl,CURLOPT_HTTPHEADER,$headerArray);curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);$output curl_exec($curl);curl_close($curl);return $output;}//时间戳
function microsecond()
{$t explode( , microtime());$microsecond round(round($t[1].substr($t[0],2,3)));return $microsecond;
}
2、查询信息
?php
$ai $_GET[ai];$url http://api2.wlc.nppa.gov.cn/idcard/authentication/query?ai.$ai;$config[appid] $_GET[appid];$config[bizid] $_GET[bizid];$config[timestamps] microsecond();$config[secretKey] $_GET[secretKey];$str $config[secretKey].ai.$ai.appId.$config[appid].bizId.$config[bizid].timestamps.$config[timestamps];$config[sign] hash(sha256, $str);$return doHttpGet($url,$data,$config);echo $return;function doHttpGet($url, $data,$config, $options null)
{$headerArray array(appId:.$config[appid],bizId:.$config[bizid],timestamps:.$config[timestamps],sign:.$config[sign]);$curl curl_init();//设置抓取的urlcurl_setopt($curl, CURLOPT_URL, $url);//设置头文件的信息作为数据流输出curl_setopt($curl, CURLOPT_HEADER, 0);// 超时设置,以秒为单位curl_setopt($curl, CURLOPT_TIMEOUT, 1);curl_setopt($curl, CURLOPT_HTTPHEADER, $headerArray);//设置获取的信息以文件流的形式返回而不是直接输出。curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);//执行命令$data curl_exec($curl);return $data;
}//时间戳
function microsecond()
{$t explode( , microtime());$microsecond round(round($t[1].substr($t[0],2,3)));return $microsecond;
}
3、行为上报
?php
$url https://api.wlc.nppa.gov.cn/idcard/authentication/check;$config[appid] $_GET[appid];$config[bizid] $_GET[bizid];$config[timestamps] microsecond();$config[secretKey] $_GET[secretKey];$collections json_decode($_GET[collections],true);$collections json_encode(array(collectionsarray($collections)));$data[data] aesGcm($collections,$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 null)
{$headerArray array(Content-Type:application/json;charsetutf-8,appId:.$config[appid],bizId:.$config[bizid],timestamps:.$config[timestamps],sign:.$config[sign]);//$header array(Content-Typeapplication/json;charsetutf-8,appId$config[appid],bizId$config[bizid],timestamps$config[timestamps],sign$config[sign]);$curl curl_init();curl_setopt($curl, CURLOPT_URL, $url);curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,FALSE);curl_setopt($curl, CURLOPT_POST, 1);curl_setopt($curl, CURLOPT_POSTFIELDS, $data);curl_setopt($curl,CURLOPT_HTTPHEADER,$headerArray);curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);$output curl_exec($curl);curl_close($curl);return $output;}//时间戳
function microsecond()
{$t explode( , microtime());$microsecond round(round($t[1].substr($t[0],2,3)));return $microsecond;
}
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/913018.shtml
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!