php自动登陆程序
时间:2005-10-12 来源:ydlhero
辛苦了一下午 好在有点成就 自动登陆程序初步完成
[color="#0000ff"]
function login($host="127.0.0.1",$msg="uname=abc&pass=psswd&op=login",$file="login.php"){
$num = strlen($msg);
$fp = fsockopen ($host, 80);
if ($fp) {
$MSGData .= "POST ".$file." HTTP/1.1
";
$MSGData .= "Host: ".$host."
";
$MSGData .= "Content-Length: ".$num."
";
$MSGData .= "Content-Type: application/x-www-form-urlencoded
";
$MSGData .= "Connection: Close
";
$MSGData .= $msg."
";
fputs ($fp, $MSGData);
while (!feof($fp)) $Tmp[]=fgets ($fp,128);
fclose ($fp);
}
return $Tmp;//返回到信息
}
[color="#0000ff"]
function login($host="127.0.0.1",$msg="uname=abc&pass=psswd&op=login",$file="login.php"){
$num = strlen($msg);
$fp = fsockopen ($host, 80);
if ($fp) {
$MSGData .= "POST ".$file." HTTP/1.1
";
$MSGData .= "Host: ".$host."
";
$MSGData .= "Content-Length: ".$num."
";
$MSGData .= "Content-Type: application/x-www-form-urlencoded
";
$MSGData .= "Connection: Close
";
$MSGData .= $msg."
";
fputs ($fp, $MSGData);
while (!feof($fp)) $Tmp[]=fgets ($fp,128);
fclose ($fp);
}
return $Tmp;//返回到信息
}
相关阅读 更多 +