胡歌 2025-08-07 15:44:25 79次浏览 0条回复 0 0 0

这里 QueryList 用的是最新版本的,与之前旧版本的写法有点差异

composer require jaeger/querylist 安装最新的代码

以 yiichina 为例:

use QL\QueryList;
//登录
$url = 'https://www.yiichina.com/login';
$loginPage = QueryList::get($url);
$_csrf = $loginPage->find('input[name="_csrf"]')->attr('value');
$postData = [
    '_csrf'  => $_csrf,
    'LoginForm[username]'  => 'aliang@qq.com',
    'LoginForm[password]'  => 'aliang123',
    'LoginForm[rememberMe]'  => '1',
];
QueryList::post($url, $postData)->getHtml();

//签到
$loginPage2 = QueryList::get('https://www.yiichina.com/');
$_csrf2 = $loginPage2->find('meta[name="csrf-token"]')->attr('content');
QueryList::post('https://www.yiichina.com/ajax/registration', ['_csrf'  => $_csrf2])->getHtml();

//发表说说
$sspost = [
    '_csrf'  => $_csrf2,
    'Feed[content]' => 'PHP是世界上最好的语言',
];
QueryList::post('https://www.yiichina.com/', $sspost)->getHtml();
    没有找到数据。
您需要登录后才可以回复。登录 | 立即注册