wodrow 2019-10-24 10:16:26 2743次浏览 0条回复 0 0 0
// 引入querylist组件,方式composer require jaeger/querylist
$home_url = "https://www.yiichina.com";
$ql = QueryList::getInstance();
$ql->get("{$home_url}/login");
$csrf = $ql->find("input[name='_csrf']")->val();
$username = \Yii::$app->params['yiichina-username'];
$password = \Yii::$app->params['yiichina-password'];;
$userInfo= [
    '_csrf'  => $csrf,
    'LoginForm[username]'  => $username,
    'LoginForm[password]'  => $password,
    'LoginForm[rememberMe]'  => '1',
];
$ql->post("{$home_url}/login", $userInfo);
$ql->get("{$home_url}");
$csrf = $ql->find("input[name='_csrf']")->val();
$ql->post("{$home_url}/registration", [
    '_csrf'  => $csrf,
], [
    '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' => "{$home_url}",
        'referer' => "{$home_url}",
        '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,
        'x-requested-with' => "XMLHttpRequest",
    ],
]);
    没有找到数据。
您需要登录后才可以回复。登录 | 立即注册