亲测可过百度站长资源平台标签验证的PHP代码,话不多说直接上教程。
首先新建一个PHP,比如baidu.php
<?php $url=$_SERVER['REQUEST_URI']; $str=""; $info=$_GET['bd']; if (isset($_GET["ming"])){ $filename=$_GET['ming']; } $info=substr($info, 0,64); $type=$_GET['type']; $type = preg_replace( '/[\W]/', '', $type); $qian='<meta name="baidu-site-verification" content="codeva-'; $hou='" />'; if ($type=="add") { if ($info) { $myfile = fopen('index.html', "r") or die("Unable to open file!"); while(!feof($myfile)){ $buf=fgets($myfile); $buf=str_replace("</head>",$qian.$info.$hou."\r\n"."</head>",$buf); $str .=$buf; } $fp2=fopen("index.html",'w'); fwrite($fp2,$str); fclose($fp2); fclose($myfile); echo json_encode(['status'=>0,'msg'=>"标签添加成功"],JSON_UNESCAPED_UNICODE); die(); } echo json_encode(['status'=>2,'msg'=>"标签参数错误"],JSON_UNESCAPED_UNICODE); die(); } if ($type="add1"){ if ($info){ $fp2=fopen("baidu_verify_".$filename.".html",'w'); fwrite($fp2,$info); fclose($fp2); echo json_encode(['status'=>0,'msg'=>"文件添加成功"],JSON_UNESCAPED_UNICODE); die(); } echo json_encode(['status'=>2,'msg'=>"文件参数错误"],JSON_UNESCAPED_UNICODE); die(); } ?>
然后新建一个index.html,代码如下:
<html> <head> <meta name="baidu-site-verification" content="codeva-SQIXZyZuyb" /> <meta name="baidu-site-verification" content="codeva-pMbc5EZ7K5" /> </head> <body> page contents </body> </html>
传参方式
格式:
http://*.ccooc.cn/2.php?type=add&bd=[值]
如:
http://abc.ccooc.cn/2.php?type=add&bd=ABC123def
查结果:
http://abc.ccooc.cn/index.html(查看源码)
得到以下结果:
<html> <head> <meta name="baidu-site-verification" content="codeva-ABC123def" /> </head> <body> page contents </body> </html>
本站所有内容仅限用于学习和研究目的,程序仅供本地断网测试,转载请说明出处!
站群SEO » 可用的百度站长资源平台HTML标签验证代码(20230217)
站群SEO » 可用的百度站长资源平台HTML标签验证代码(20230217)