http://s.yanghao.org/program/viewdetail.php?i=194607
PHP code
< HTML > < HEAD > < TITLE > New Document </ TITLE > < meta http - equiv = " Content-Type " content = " text/html; charset=gb2312 " > </ HEAD > < BODY > <? php include " Snoopy.class.php " ; $snoopy = new Snoopy; // 获取表单需要的字段 /* $snoopy->fetchform("http://www.phpx.com/happy/logging.php?action=login"); echo $snoopy->results."<br />"; */ $submit_url = " http://www.phpx.com/happy/logging.php?action=login " ; $submit_vars [ " cookietime " ] = " 2592000 " ; $submit_vars [ " loginfield " ] = " username " ; $submit_vars [ " username " ] = " 你的用户名 " ; // 你的用户名 $submit_vars [ " password " ] = " 你的密码 " ; // 你的密码 $submit_vars [ " questionid " ] = " 0 " ; $submit_vars [ " answer " ] = "" ; $submit_vars [ " loginsubmit " ] = " 登录 " ; // $submit_vars["loginsubmit"] = "dl"; //可以 //$submit_vars["loginsubmit"] = ""; //不行 //问题1:为什么要加入上面那句:$submit_vars["loginsubmit"] = "登录",而且“登录”改为任何字眼都可以,但“”不可以 $snoopy -> submit( $submit_url , $submit_vars ); echo $snoopy -> results; // 问题2:登录成功后跳转到http://127.0.0.1/snoopy/index.php ?> </ BODY > </ HTML >