不想去查询备案号再填写到网站上面,而且有时候更换备案了这个还要重新去获取信息,给大家带来一个很方便的方法自动获取备案号。
<?php
header("Content-type: application/json; charset=utf-8");
echo "{document.write('" . ok(get_Domain()) ."');}";function ok($url){$APIurl = urldecode(base64_decode('aHR0cHMlM0ElMkYlMkZhcGkub29vbW4uY29tJTJGYXBpJTJGaWNw'));$apiKey = '';//获取apiKey地址:,注册后免费获取$data = OooMn('' . $APIurl . '','apiKey=' . $apiKey . '&domain=' . $url . '');$data = json_decode($data, true);$info = $data['icp'];return $info ;
}function get_Domain()
{$scriptpath = str_replace('\', '/', $_SERVER['SCRIPT_NAME']);$sitepath = substr($scriptpath, 0, strrpos($scriptpath, '/'));$siteurl = ($_SERVER['SERVER_PORT'] == '443' ) . $_SERVER['HTTP_REFERER'] . $sitepath;return $siteurl;
}function OooMn($url, $post = 0 , $header = 0)
{$ua = $_SERVER['HTTP_USER_AGENT'];$referer = $_SERVER['HTTP_REFERER'];$ch = curl_init();curl_setopt($ch, CURLOPT_URL, $url);curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);$httpheader[] = "Accept:*/*";$httpheader[] = "Accept-Encoding:gzip,deflate,sdch";$httpheader[] = "Accept-Language:zh-CN,zh;q=0.8";$httpheader[] = "Connection:close";curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader);if ($post) {curl_setopt($ch, CURLOPT_POST, 1);curl_setopt($ch, CURLOPT_POSTFIELDS, $post);}if ($header) {curl_setopt($ch, CURLOPT_HEADER, true);}curl_setopt($ch, CURLOPT_REFERER, $referer);curl_setopt($ch, CURLOPT_USERAGENT, $ua);curl_setopt($ch, CURLOPT_ENCODING, "gzip");curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);$content = curl_exec($ch);curl_close($ch);return $content;
}
网站实现调用
此时在你需要调用显示的地方输入以下代码,即可实现ICP备案号的自动获取并显示。
<a href="" target="_blank"><script src="这里填入自动获取地址"></script></a>
<a href="" target="_blank"><script src=""></script></a>
<a href="" target="_blank"><img src=".png" style="height: 17px;"><script src=""></script></a>
本文发布于:2024-01-28 17:48:20,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/17064353059169.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |