本站自动签到脚本

Yii 圈
0 0
// 先引入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,放入计划任务就可以自动签到
  • 评论于 2019-07-24 11:43 举报

    排版有问题,脚本再发下

    $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",
        ],
    ]);
    
    , 觉得很赞
  • 评论于 2019-07-29 09:03 举报

    真是牛批啊

您需要登录后才可以评论。登录 | 立即注册

Yii 圈

Yii 圈

Yii 是一个 高性能 的,适用于开发 WEB 2.0 应用的 PHP 框架。

  • 话题12
  • 会员62

相关话题