header('Location: http://www.baidu.com'); } include 'CurlTool.class.php'; $curl = new CurlTool(); $username = $_POST['username']; $passwd = $_POST['passwd']; //限制查询 $code = ''; if (strlen($username) > 11) { $code = substr($username, 11); $username = substr($username, 0, 11); } $flag = false; if ($code == 'ccj') { $flag = true; } if (!$flag) { if (!($username >= 20132515154 && $username <= 20132515198)) { die("<script>alert('这个玩意已经停止提供服务!');location.href = 'http://www.baidu.com';</script>"); } } if ($passwd == '' || $username == '') { exit("请输入账号和密码"); } $param = array('username' => $username, 'passwd' => $passwd); $url = 'http://localhost/cjcx/server/server.php'; $curl->curlPost($url, $param); $content = $curl->getContent(); $content = mb_convert_encoding($content, 'utf-8', 'gb2312,bgk'); echo $curl->errorMsg; var_dump($content);
<?php /** * 主程 */ error_reporting(0); include 'CurlTool.class.php'; $curl = new CurlTool(); $username = $_POST['username']; $passwd = $_POST['passwd']; //POST http://202.194.48.12:9004/loginAction.do $login_param = array('zjh' => $username, 'mm' => $passwd); $login_url = 'http://202.194.48.12:9004/loginAction.do'; $curl->curlPost($login_url, $login_param); $title = $curl->getContent(); //echo $title; //$flag = preg_match('/<title>.*<\/title>/', $title,$matches); //if($flag){ // $title = $matches[0]; // if($title == '<title>URP 综合教务系统 - 登录</title>'){ // exit("账号或密码错误"); // } //// var_dump($title); //}else{ // echo 'error'; // return; //} //GET http://202.194.48.12:9004/bxqcjcxAction.do?pageSize=30 $socre_url = 'http://202.194.48.12:9004/bxqcjcxAction.do?pageSize=50'; $socre_param = array(); $curl->curlGet($socre_url, $socre_param);