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增加收录
function objtoarr($obj){ $ret = array(); foreach($obj as $key =>$value){ if(gettype($value) == 'arr...
001源码:/* * $xml_str是xml字符串 */ function xmltoarray($xml_str) { //禁止XML实体扩展攻击 libxml_disable_entity_loader(true); //拒绝包含...
(1).学习目标: 了解常见信号类型(百度PHP支持的信号类型),(2).相关函数学习: (2.1).pcntl_signal函数用于设置一个信号管理器接收进程信号,参数1:信号类型,参数2:回调函数,用于在接收到参数1类型的信...
今天帮朋友查询wordpress执行超级慢的原因,特此记录开启fpm的慢日志,记录执行超过30秒的脚本request_slowlog_timeout = 30 slowlog = var/log/slow.log查看日志[23-May-2019 17...
php7新增的特性(1).强制限制只能返回一种类型<?php class task { } //must return an integer function add(): int { &nb...
概念请参考w3school文章: redis watch ,redis exec (看完基本秒懂)(1)基本事务://连接本地的 Redis 服务 $redis = new Redis(); $redis->con...