hostloc刷20积分-php代码

2018年1月2日 367点热度

hostloc.php代码:

<?php

$username = "修改";  //LOC账户
$password = "修改";  //LOC密码


//*******************以下不用修改*******************

set_time_limit(600);

$suburl = "http://www.hostloc.com/member.php?mod=logging&action=login";
$loginInfo = array(
        "username" => $username,
        "password" => $password,
        "fastloginfield" => "username",
        "quickforward" => "yes",
        "handlekey" => "ls",
        "loginsubmit" => true
);


$login = postData($suburl,$loginInfo);

$spaceUrl = "http://www.hostloc.com/space-uid-*.html";

for($i=20940;$i<20952;$i++)
{
        getData(str_replace("*",$i,$spaceUrl));
}

function postData($url, $post_data)
{
        $ch = curl_init ();
        curl_setopt($ch , CURLOPT_POST , 1);
        curl_setopt($ch , CURLOPT_HEADER , 0);
        curl_setopt($ch , CURLOPT_URL , $url);
        curl_setopt($ch , CURLOPT_COOKIEJAR , 'hostloc.cookie');
        curl_setopt($ch , CURLOPT_POSTFIELDS , $post_data);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_TIMEOUT,600);
        curl_setopt($ch, CURLOPT_REFERER, 'http://www.hostloc.com/'); 
        $result = curl_exec($ch);
        curl_close($ch);
        return $result;
}


function getData($url)
{
        $ch = curl_init ();
        curl_setopt($ch, CURLOPT_HEADER , 0);
        curl_setopt($ch, CURLOPT_URL , $url);
        curl_setopt($ch, CURLOPT_COOKIEFILE, 'hostloc.cookie');
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_TIMEOUT,600);
        $result = curl_exec($ch);
        curl_close($ch);
        return $result;
}
- 登录vps,新建php文件hostloc.php复制以上代码,然后curl测试执行:
curl -sS --connect-timeout 10 -m 60 'https://domain.men/test/hostloc.php'
- 出现以下警告不影响效果:
Warning: curl_setopt(): CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set in /www/wwwroot/test/hostloc.php on line 57

每日定时:

- 宝塔设置每天定时访问网址:https://domain.com/test/hostloc.php
- 使用其他URL访问工具

参考链接:

HostLoc签到脚本汇总,HostLoc自动定时翻牌拿好每天20金币 | www.vpsbuluo.com/ziyuan/312.html

SSJ

不积跬步无以至千里