搜狗推送代码

PHP 2019-10-28 10:25:21 评论

为自动推送版本

PHP

function sogou(){

$yuming = "
https://www.baidu.com
";

//随机字符
function suijizf($length){ 
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; 
$password = ''; 
for ( $i = 0; $i < $length; $i++ ) 
{ 
// $password .= substr($chars, mt_rand(0, strlen($chars) – 1), 1); 
$password .= $chars[ mt_rand(0, strlen($chars) - 1) ]; 
} 
return $password; 
} 

//搜狗站长登录后的cookies
$ck0='SUID=1C15EE72D831990A000000005DB53906; SUV=1572157704157296; PHPSESSID=8l314rv23u810d8mcidj440ie4; sgid=15-43121071-AV21ORfbyscyCrqT83qn6Ag';//cookies
$ck1='SUID=1C15EE72D831990A000000005DB53C91; SUV=1572158610169738; PHPSESSID=b34nqlphte53fgcftctjcoklg3; sgid=29-43103401-AV21PKcHHVhQEE3LrhoCApY';
$reason='';//详细说明,可以为空
$email= suijizf(4).'@'.suijizf(4).'.com';//邮箱,不可为空

$cook = array($ck0,$ck1);
$cookies = $cook[rand(0,1)];




$data = explode(PHP_EOL,$yuming,1000);
$data_1 = array_unique($data); //array_unique函数:过滤重复的值
$data_2 = array_filter($data_1); //array_filter函数:过滤数组中为空的值
$ym = array_values($data_2);//array_values函数:被返回的数组将使用数值键,从 0 开始并以 1 递增。
shuffle($ym);
//$url[]='';
for($i=1;$i<=20;$i++){
$urls[]=$ym[0].'/2019/'.suijizf(8).'.html';
}

//搜狗提交
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, 'http://zhanzhang.sogou.com/index.php/urlSubmit/create');
	$httpheader[] = "Cookie: ".$cookies;
	curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS,$text);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.81 Safari/537.36 SE 2.X MetaSr 1.0");
    curl_setopt($ch, CURLOPT_TIMEOUT, 50);
    $output = curl_exec($ch);
    curl_close($ch);
	return  $output;

$arr=array_chunk($urls, 20);
foreach($arr as $v){
	$info= array(
	 "webAdr"=>implode("\n", $v),
	 "site_type"=>'2',
	 "reason"=>$reason,
	 'email'=>$email,
	 );
	//echo post($cookies,$info);
}

}
echo sogou();

JS

<script language="JavaScript">
function myrefresh()
{
   window.location.reload();
}
setTimeout('myrefresh()',3000); //指定1秒刷新一次
</script>

评论

说点什么吧
  • 全部评论(0
    还没有评论,快来抢沙发吧!