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增加收录
//参数1 文件名 参数2 缩放比例 function _thumb($_filename,$_percent){ ob_clean();...
原理:使用curl_init()创建多个请求实例,再使用curl_multi_init()批量执行创建的多个请求实例。文件1:curl.php<?php $threads=500;//并发请求次数 $url='http://blog.cn/index.php?';...
在PHP中,大部分变量类型,如字符串,整型,浮点,数组等都是值类型的,而类和对象是引用类型.和其他语言有点差距.(1).在值类型中我们直接使用&符号表示指向对应变量的内存地址,当前变量和被指向的变量只要有1个的值被修改都会直接影响另外一个变量的值发生变化。(ps:还是非常节省内存的,可以使用...
(1).config.php 配置文件<?php /** * RabbitMQ_Config */ $config = [ 'host' => ...
自己的composer已经发布到packagist,但是无法使用composer require easy-task/easy-task来安装,只能在配置文件使用如下方式安装:"require": { "easy...
经常我们下载国外资源容易被墙,可以通过php脚本获取远程文件流然后输出给我们的浏览器来下载。<?php //设置下载文件的url $url = 'https://mirrors.huaweicloud.com/ubuntukylin/ubuntukylin-19....