// 先引入querylist组件,querylist是一个强大的爬虫组件,引入方式composer require jaeger/querylist
// 签到代码
$ql = QueryList::getInstance();
$ql->get("https://php.la/login");
$csrf = $ql->find("input[name='_csrf-frontend']")->val();
$username = 'username';
$password = 'password';
$userInfo= [
'_csrf-frontend' => $csrf,
'LoginForm[username]' => $username,
'LoginForm[password]' => $password,
'LoginForm[rememberMe]' => '1',
];
$ql->post("https://php.la/login", $userInfo);
$ql->get("https://php.la");
$csrf_token = $ql->find('meta[name="csrf-token"]')->attr('content');
$ql->post("https://php.la/registration", [
'_csrf' => $csrf_token,
], [
'headers' => [
'accept' => "application/json, text/javascript, */*; q=0.01",
'accept-encoding' => "gzip, deflate, br",
'accept-language' => "en,zh-CN;q=0.9,zh;q=0.8,zh-TW;q=0.7",
'content-type' => "application/x-www-form-urlencoded; charset=UTF-8",
'origin' => "https://php.la",
'referer' => "https://php.la",
'user-agent' => "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36",
'x-csrf-token' => $csrf_token,
'x-requested-with' => "XMLHttpRequest",
],
]);
// 配置username,password,放入计划任务就可以自动签到
共 2 条评论
排版有问题,脚本再发下
真是牛批啊