刷hostloc积分代码
<meta charset="UTF-8">
<script language="javascript">
for(var i=0;i<=10;i++){
var link=document.createElement("img");
link.href="http://www.hostloc.com/space-uid-"+Math.floor(10000 + Math.random() * (24000 - 10000))+".html";
document.head.appendChild(link);
}
alert("刷分完毕");
</script>
<head/>
<?php
function login_post($url, $cookie, $post) {
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 0);
curl_setopt($curl, CURLOPT_COOKIEJAR, $cookie);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post));
curl_exec($curl);
curl_close($curl);
}
function get_content($url, $cookie) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
$rs = curl_exec($ch);
curl_close($ch);
return $rs;
}
$user = array( 'zhanghao','zhanghao');
$pwd = array('mima', 'mima');
for ($i = 0; $i < count($user); $i++) {
echo $i;
$post = array(
'mod' => 'logging',
'action' => 'login',
'loginsubmit' => 'yes',
'infloat' => 'yes',
'lssubmit' => 'yes',
'username' => $user[$i],
'password' => $pwd[$i]
);
$url = "http://www.hostloc.com/member.php";
$cookie = dirname(__FILE__) . '/cookie_lochost.txt';
login_post($url, $cookie, $post);
for ($i = 0; $i <= 12; $i++) {
$url2 = "http://www.hostloc.com/space-uid-" . rand(10000, 24000) . ".html";
$content = get_content($url2, $cookie);
//echo $content;
}
$preg = '{<a\b[^>]+\bhref="([^"]*)"[^>]*>退出</a>}';
preg_match_all($preg, $content, $arr);
//test
echo $arr[1][0];
echo 'http://www.hostloc.com/' . $arr[1][0];
$content = get_content('http://www.hostloc.com/' . $arr[1][0], $cookie);
echo $content;
@unlink($cookie);
}
?>
1 条评论
学习了,