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增加收录
开启错误提示代码:ini_set("display_errors", "On"); error_reporting(E_ALL | E_STRICT);关闭错误提示代码:error_reporting(E_ALL ^&n...
当我想在一个进程中监听kill 和 kill -9命令报了这个错误。//监听kill pcntl_signal(SIGTERM, function () { posix_kill(0, SIGTERM); });...
将jsonp转为PHP数组和对象。/** * jsonp转数组|Jsonp转json * @param string $jsonp jsonp字符串 * @param bool $as...
本教程使用的定时任务基于EasyTak,EasyTask官方文档:https://gitee.com/392223903/EasyTask由于tp3.2.x官方开发未考虑命令行支持和绝对路径开发的标准,因此我编写了一个支持的类来运行。1.在tp3.2.3根目录下安装easytaskcomposer&...
(1).今天遇到一件奇怪的事情,在event事件中是无法自定义异常处理,例如我们使用set_exception_handler来统一处理异常。例如下面的代码:<?php error_reporting(E_ALL); set_error_handler(function ($errn...
<?php function getStartFile() { $backtrace = \debug_backtrace(); if($backtrace) &nb...