当前位置:首页 > PHP > 正文内容

php调用谷歌无头浏览器访问网页+推送百度(代码备份)

高老师5年前 (2021-01-19)PHP1931

php调用谷歌无头浏览器访问网页(代码备份):

<?php
$i = 1403;
while ($i--) {
    $url = "https://wap.xingxinghan.cn/?id=" . $i;
    $cmd = "chrome --headless --disable-gpu  $url";
    echo $url . PHP_EOL;
    exec($cmd);
    sleep(10);
    push($url);
}

function push($url)
{
    $urls = array(
        $url,
    );
    $api = 'http://data.zz.baidu.com/urls?site=https://wap.xingxinghan.cn&token=JFlzEXUDAXAZDvXyZl2';
    $ch = curl_init();
    $options = array(
        CURLOPT_URL => $api,
        CURLOPT_POST => true,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_POSTFIELDS => implode("\n", $urls),
        CURLOPT_HTTPHEADER => array('Content-Type: text/plain'),
    );
    curl_setopt_array($ch, $options);
    $result = curl_exec($ch);
    echo $result . PHP_EOL;
}


<?php
while(true)
{
    $response = file_get_contents('http://learn.gaojiufeng.cn/index/test1x/showId');
    $response = json_decode($response);
    foreach ($response as $key => $value) {
        $url = "https://blog.20230611.cn/?id=" . $value;
        $cmd = "chrome --headless --disable-gpu --window-size=1920x1080  $url";
        echo $url . PHP_EOL;
        echo $cmd . PHP_EOL;
        exec($cmd);
        sleep(15);
    }
}

目的:刷真实PV增加收录

扫描二维码推送至手机访问。

版权声明:本文由高久峰个人博客发布,如需转载请注明出处。

本文链接:https://blog.20230611.cn/post/193.html

分享给朋友:

“php调用谷歌无头浏览器访问网页+推送百度(代码备份)” 的相关文章

PHP使用post发送Json数据

PHP使用post发送Json数据

前公司吃饭是需要在钉钉报餐的,对于不挑剔的我每天都在公司吃饭,有时忘记报餐导致吃不了饭还是很麻烦的。看了下报餐系统需要的是json数据包含我的工号即可。于是编写如下代码,放在360网址监控,1小时执行1次<?php /*自动报餐类*/ class  AutoBaocan{...

PHP函数赋值给一个变量的另类用法

PHP函数赋值给一个变量的另类用法

<?php   function  go($str) { echo'I\'m '.$str;  }   $goto='go';   $goto('gaojiufeng'...

PHP获取原始数据

PHP获取原始数据

在项目中需要对图片进行裁剪,前端裁剪完成发送base64给后端,但是很意外的PHP获取到的数据和前端有点差距,之前我都是先加密,后端解密,但是这次依然不行。于是使用filter_input方法轻松解决。$base64 =  filter_input(INPUT_POST...

php 开启错误提示,php 关闭错误提示

php 开启错误提示,php 关闭错误提示

开启错误提示代码:ini_set("display_errors", "On"); error_reporting(E_ALL | E_STRICT);关闭错误提示代码:error_reporting(E_ALL ^&n...

php非对称加密

php非对称加密

先在centos安装openssl,然后开始://生成私钥openssl genrsa -out rsa_private_key.pem 1024//生成公钥openssl rsa -in rsa_private_key.pem&...

抛弃salt,使用password_hash()加密

抛弃salt,使用password_hash()加密

md5/sha1+salt方式是目前各大cms常用的加密方式,虽然salt安全,但是各大md5网站也在研究这个方向,那么我们应该选择password_hash动态hash来助力,一种密码有多种hash结果.看代码模拟登陆.<?php //01.注册 $user ='zhang...