我需要登录一个网站来废弃数据,但我无法登录。下面是我的代码
我需要输入值的形式
<FORM id=form1 style="BACKGROUND-COLOR: #ffffff" name=form1 action="http://120.146.143.32/cgi-bin/APWPW.EXE" method=post>
<SPAN style="WIDTH: 715px; POSITION: relative; HEIGHT: 295px">
<SPAN id=text1 style="FONT-SIZE: 40px; LEFT: 130px; WIDTH: 490px; POSITION: absolute; TOP: 30px; HEIGHT: 20px">
<P>Welcome to Online Ordering</P></SPAN>
<SPAN id=text2 style="LEFT: 130px; WIDTH: 110px; POSITION: absolute; TOP: 110px; HEIGHT: 20px">
<P>Your Account #</P></SPAN>
<SPAN id=text3 style="LEFT: 130px; WIDTH: 110px; POSITION: absolute; TOP: 150px; HEIGHT: 20px">
<P>Password</P></SPAN>
<SPAN name=account style="LEFT: 260px; WIDTH: 166px; POSITION: absolute; TOP: 110px; BACKGROUND-COLOR: #ffff00"> APW146 </SPAN>
<INPUT id=password1 style="LEFT: 260px; WIDTH: 168px; POSITION: absolute; TOP: 150px; BACKGROUND-COLOR: #ffff00" type=password value="" name=password1>
<SPAN id=text4 style="LEFT: 10px; WIDTH: 300px; POSITION: absolute; TOP: 260px; HEIGHT: 20px">
<P>Keyin your Password then press enter</P></SPAN>
<INPUT id=inputimage1 style="LEFT: 460px; WIDTH: 200px; POSITION: absolute; TOP: 90px; HEIGHT: 170px" type=image src="http:/cobol/APW.JPG" name=inputimage1>
<INPUT type=hidden name=hpath value=\APW\>
<INPUT type=hidden name=haccount value=APW146>
</SPAN>
</FORM>
这是我的 Curl 登录功能
function login(){
$ch = curl_init();
//curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
// curl_setopt($ch, CURLOPT_URL, 'http://120.146.143.32/cgi-bin/APWPW.EXE');
curl_setopt($ch, CURLOPT_URL, 'http://120.146.143.32/cgi-bin/APW.EXE'); //login URL
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "MozillaXYZ/1.0");
//curl_setopt ($ch, CURLOPT_REDIRECT_URL,'http://120.146.143.32/cgi-bin/APW.EXE');
$user = array(
'account' => 'APW146',
'haccount'=>'APW146',
'password1'=>'',
'inputimage1.x' => '0',
'inputimage1.y' => '0',
'hpath' =>'\APW\\'
);
print_r($user);
//echo "\APW\\";
// echo $postData;
//exit();
// curl_setopt($ch,CURLOPT_POSTFIELDS, array('password1=XXXXXXXX&inputimage1.x=0&inputimage1.y=0&hpath=%5CAPW%5C&haccount=APW146'));
curl_setopt ($ch, CURLOPT_POSTFIELDS, $user);
curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$store = curl_exec ($ch);
// header("Set-Cookie:__utma=176595493.25749725.1353988994.1353988994.1353988994.1");
header("Set-Cookie:__utmz=176595493.1353988994.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none);Set-Cookie:__utma=176595493.25749725.1353988994.1353988994.1353988994.1");
// print_r($store);
var_dump(curl_getinfo($ch));
// echo $store;
//exit();
return $ch;
}
我做 var_dump 时得到的输出
array (size=22)
'url' => string 'http://120.146.143.32/cgi-bin/APW.EXE' (length=37)
'content_type' => string 'text/html' (length=9)
'http_code' => int 200
'header_size' => int 197
'request_size' => int 226
'filetime' => int -1
'ssl_verify_result' => int 0
'redirect_count' => int 0
'total_time' => float 0.187
'namelookup_time' => float 0
'connect_time' => float 0.062
'pretransfer_time' => float 0.062
'size_upload' => float 659
'size_download' => float 1703
'speed_download' => float 9106
'speed_upload' => float 3524
'download_content_length' => float 1703
'upload_content_length' => float 659
'starttransfer_time' => float 0.109
'redirect_time' => float 0
'certinfo' =>
array (size=0)
empty
'redirect_url' => string '' (length=0)
var_dump($store) 的输出;
string '<HTML>
<HEAD>
<TITLE></TITLE>
<META http-equiv="Content-Type" content="text/html">
<META NAME="GENERATOR" CONTENT="FUJITSU NetCOBOL">
<SCRIPT LANGUAGE=JavaScript>
function body1_onload_func()
{
if (document.form1.hbalances.value=="Y")
document.form1.submit5.style.visibility="visible"
else
document.form1.submit5.style.visibility="hidden"
}
function onclick_func_b1()
{
document.form1.hchoice.value="SA"
}
function onclick_func_b2()
{
document.form1.hchoice.value="OS"
}
function oncli'... (length=2710)
出于安全原因,我无法提供该帐户的密码。
谢谢抗体