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增加收录
header() 函数向客户端发送原始的 HTTP 报头。(官方解释)通俗的讲header函数将参数中的字符串作为服务端的响应头来返回给客户端。什么是服务端的响应头?打开谷歌浏览器看看network中的请求response header信息即可。更多的参数百度response header即可浏览器...
使用php函数array_multisort()即可实现和SQL一样的order by排序. 例如我们需要对会员表按照主键降序排列,年龄升序排列://会员表数据 $list = []; $list[] = ['mid' =>&n...
array_merge是最常用的数组合并方法,+号同样也可以,但是却有很大不同。array_merge遇到相同字符串key,后面数组的key会覆盖前面数组的key,+号正好相反。$a = [ 'one' => 'A on...
<?php //php7+ define('CONFIG', [ 'MYSQL' => '127.0.0.1',  ...
文章篇幅较长,如果不喜欢看文章的,此处抛出韩顺丰老师的位运算视频,韩老师应该是全网讲php位运算符最详细的一个老师了。链接:https://pan.baidu.com/s/14xj7er8eVSUcJ-jYXyA0GA 提取码:731m 链接:https://pan.baidu.com...
(1).php.ini配置允许加载远程文件allow_url_fopen = On(2).创建本地文件invoke.php<?php require('https://blog.20230611.cn/test.txt');(3).创建远程文件https:/...