$url = "http://202.206.20.36/ACTIONLOGON.APPPROCESS?mode=4"; //登录地址 $cookiepath = dirname(__FILE__) . '/cookie_oschina.txt'; //设置cookie保存路径 $imgSavePath = dirname(__FILE__) . '/verifycode.jpeg'; //验证码保存的地址 $imgURLPath = "http://202.206.20.36/ACTIONVALIDATERANDOMPICTURE.APPPROCESS"; //需要获取的验证码的URL save_verifycode($imgURLPath, $cookiepath, $imgSavePath); //初始化用户名、密码、验证码和需要提交的信息 $verifycode = get_verifycode($imgSavePath); @unlink($imgSavePath); //删除验证码图片,用完赶紧删 $postfields = "WebUserNO={$user}&Password={$password}&Agnomen={$verifycode}"; $url_content = "http://202.206.20.36/ACTIONFINDSTUDENTINFO.APPPROCESS?mode=1&showMsg="; login_post($url, $cookiepath, $postfields); $content = get_content($url_content, $cookiepath); //获取登录页的信息 $en_content = mb_convert_encoding($content, 'UTF-8', 'UTF-8,GBK,GB2312,BIG5'); //对返回的信息进行编码,不然会乱码 @unlink($cookiepath); //删除cookie文件 //匹配页面信息 $patternNum = "/<td colspan=\"2\" align=\"left\"> (.*)<\\/td>/i"; $patternMaj = "/<td width=\"35%\" align=\"left\"> (.*)<\\/td>/i"; $patternCol = "/<td width=\"35%\" align=\"left\" nowrap> (.*)<\\/td>/i"; preg_match_all($patternNum, $en_content, $arrNum); preg_match_all($patternMaj, $en_content, $arrMaj); preg_match_all($patternCol, $en_content, $arrCol); $data = array("password" => $password, "stuNum" => $arrNum[1][0], "name" => $arrNum[1][1], "sex" => $arrNum[1][4], "phoneNum" => $phoneNum, "major" => $arrMaj[1][15], "college" => $arrCol[1][0]); if ($data["stuNum"] == "" | $data["name"] == "" | $data["sex"] == "" | $data["major"] == "" | $data["college"] == "") {
$url = 'http://ben.com/get/index.php?action=login'; $ip = getIP(); $BeginDateTime = date("Y-m-d"); @($domain_c = '&domain_c=' . $_POST['host']); @($ip_c = '&ip_c=' . $ip); @($key_c = '&key_c=' . $_POST['key_c']); @($tel_c = '&tel_c=' . $_POST['tel_c']); @($BeginDateTime = '&BeginDateTime=' . $BeginDateTime); @($EndDateTime = '&EndDateTime=' . $_POST['EndDateTime']); $url2 = "http://ben.com/get/index.php?action=qqsList" . $domain_c . $ip_c . $key_c . $tel_c . $BeginDateTime . $EndDateTime; $post = array('username' => '***', 'password' => '***'); //吓死本宝宝了 $cookie = __FILE__ . '\\cookie.txt'; $file = __FILE__ . '\\file.txt'; //回调溢出... $get_cookie = login_post($url, $cookie, $post); //为处理回调溢出 echo '<ben>'; $content = get_content($url2, $cookie); $exp_data = explode('left_txt2', $content); $val = $exp_data[2]; preg_match_all('/<td>(.*?)<\\/td>/', $val, $preg_val); $time = $preg_val[1][0]; $tel = $preg_val[1][1]; $address = $preg_val[1][2]; $ip = $preg_val[1][3]; $url = $preg_val[1][5]; preg_match('/<a(.*?)>(.*?)<\\/a>/', $tel, $preg_tel); $tel = $preg_tel[2]; preg_match('/<a(.*?)>(.*?)<\\/a>/', $ip, $preg_ip); $ip = $preg_ip[2];
$cookie_file = dirname(__FILE__) . '/cookie.txt'; //$cookie_file = tempnam("tmp","cookie"); //先获取cookies并保存 $url = "http://sep.ucas.ac.cn"; $ch = curl_init($url); //初始化 curl_setopt($ch, CURLOPT_HEADER, 0); //不返回header部分 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //返回字符串,而非直接输出 curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file); //存储cookies curl_exec($ch); curl_close($ch); $s = decrypt($s, "abc"); login_post("http://sep.ucas.ac.cn/slogin", $cookie_file, $s); $url = "http://sep.ucas.ac.cn/portal/site/226/821"; $ch = curl_init($url); //初始化 curl_setopt($ch, CURLOPT_HEADER, 1); //不返回header部分 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //返回字符串,而非直接输出 //curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file); //存储cookies curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file); //存储cookies $data = curl_exec($ch); curl_close($ch); $url = "http://sep.ucas.ac.cn/portal/site/226/821";
<?php include __DIR__ . '/common/config.php'; include __DIR__ . '/common/functions.php'; // 模拟登陆 login_post(E_LOGIN_URL, E_COOKIE_PATH, ['UserName' => E_USERNAME, 'Password' => E_PASSWORD]); // 模拟获取学习列表 $content = get_content(sprintf(E_LIST_URL, 1000, 1), E_COOKIE_PATH); @unlink(E_COOKIE_PATH); // 保存列表 $list = json_decode($content, true); foreach ($list['rows'] as $item) { import_word(['word' => trim(strip_tags($item['cell'][1])), 'phonetic_symbol' => trim(strip_tags($item['cell'][2])), 'explanation' => trim(str_replace('<br>', "\n", $item['cell'][3])), 'grade' => $item['cell'][4], 'add_time' => date('Y-m-d', strtotime($item['cell'][5])), 'email_count' => 0, 'unique_id' => $item['cell'][6]]); } echo count($list['rows']);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie); //读取cookie curl_setopt($ch, CURLOPT_REFERER, "http://jw.jxust.cn/xskbcx.aspx?xh=''&xm=''&gnmkdm=N121603"); $rs = curl_exec($ch); //执行cURL抓取页面内容 curl_close($ch); $pattern = '/<input type="hidden" name="__VIEWSTATE" value="(.*?)" \\/>/is'; preg_match_all($pattern, $rs, $matches); $res[0] = $matches[1][0]; return $res; } //获得前端提交的数据 //设置post的数据 $post = array('__VIEWSTATE' => $view[0], 'tname' => 'bt1', 'tbtns' => 'bt1', 'tnameXw' => 'yhdl', 'tbtnsXw' => 'yhdl|xwxsdl', 'txtYhm' => $username, 'txtXm' => '', 'txtMm' => $password, 'rblJs' => '学生', 'btnDl' => '登 录'); //模拟登录 login_post($url, $cookie, $post); //获取登录页的信息 $ress = get_res($url2, $cookie); //$data 是查询课表所需要提交的数据 $data = array('__EVENTTARGET' => 'xnd', '__EVENTARGUMENT' => '', '__VIEWSTATE' => $ress[0], 'xnd' => $term, 'xqd' => $num); $kebiao = get_content($url2, $cookie, "http://jw.jxust.cn/xskbcx.aspx?xh={$username}&xm=''&gnmkdm=N121603", $data); preg_match_all('/<table id="Table1"[\\w\\W]*?>([\\w\\W]*?)<\\/table>/', $kebiao, $out); $table = $out[0][0]; //获取整个课表 preg_match_all('/<td [\\w\\W]*?>([\\w\\W]*?)<\\/td>/', $table, $out); $td = $out[1]; $length = count($td); //获得课程列表 for ($i = 0; $i < $length; $i++) { //$td[$i] = str_replace("<br>", "", $td[$i]); $reg = "/{(.*)}/";
<?php $txtUserName = $_POST['txtUserName']; $txtPwd = $_POST['txtPwd']; $code = $_POST['txtCheckCode']; $cookie = base64_decode($_POST['value']); $hiddens = $_POST['__VIEWSTATE']; $hiddense = $_POST['__EVENTVALIDATION']; $fields = array('__EVENTTARGET' => '', '__EVENTARGUMENT' => '', '__VIEWSTATE' => $hiddens, 'txtUserName' => $txtUserName, 'txtPwd' => $txtPwd, 'txtCheckCode' => $code, 'btnUserLogin' => '', '__EVENTVALIDATION' => $hiddense); $url2 = "http://172.18.0.240/selfsearch/EcardInfo/UserBaseInfo_Seach.aspx"; @($loginresult = login_post($cookie, $fields)); if ($loginresult != FALSE) { gethidden($cookie); @($res = get_content($url2, $cookie)); include 'view/head.php'; include 'view/basic.php'; }
$post_url = "http://59.77.226.32/logincheck.asp"; $muser = $_POST["stunum"]; $passwd = $_POST["passwd"]; $header[0] = "Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"; $header[] = "Accept-Encoding:gzip, deflate"; $header[] = "Accept-Language:zh-CN,zh;q=0.8"; $header[] = "Cache-Control:max-age=0"; $header[] = "Connection:keep-alive"; $header[] = "Content-Type:application/x-www-form-urlencoded"; $header[] = "Host:59.77.226.32"; $header[] = "Origin:http://jwch.fzu.edu.cn"; $header[] = "Referer:http://jwch.fzu.edu.cn/"; $header[] = "Upgrade-Insecure-Requests:1"; $header[] = "User-Agent:Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36"; $post = array("muser" => $muser, "passwd" => $passwd); $first_response_header[] = login_post($post_url, $header, $post); $second_response_header = login_get($first_response_header[0][0]['redirect_url'], $header); preg_match_all("{[a-zA-z]+://[^\\s]*}", $second_response_header, $matches); preg_match_all("{id=\\d*}", $matches[0][0], $matches2); $id = substr($matches2[0][0], 3); preg_match_all("{Set-Cookie: .*?(?=;)}", $second_response_header, $matches3); $sessionid = substr($matches3[0][0], 12); $get_info_url = "http://59.77.226.35/jcxx/xsxx/StudentInformation.aspx?id=" . $id; $header[] = "Cookie:" . $sessionid; $info_html = login_get_content($get_info_url, $header); preg_match_all("{<span id=\"ContentPlaceHolder1_LB_xm\">.*?(?=</span>)}", $info_html, $info_matches); $name = substr($info_matches[0][0], 37); preg_match_all("{<span id=\"ContentPlaceHolder1_LB_xymc\">.*?(?=</span>)}", $info_html, $info_matches2); $dept = substr($info_matches2[0][0], 39); $return_array = array('stunum' => $muser, 'name' => $name, 'dept' => $dept); $json_str = json_encode($return_array);
$pwd = $_POST['pwd']; $cookie_file = dirname(__FILE__) . '/cookie.txt'; //$cookie_file = tempnam("tmp","cookie"); //先获取cookies并保存 $url = "http://sep.ucas.ac.cn"; $ch = curl_init($url); //初始化 curl_setopt($ch, CURLOPT_HEADER, 0); //不返回header部分 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //返回字符串,而非直接输出 curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file); //存储cookies curl_exec($ch); curl_close($ch); login_post("http://sep.ucas.ac.cn/slogin", $cookie_file, $username, $pwd); $url = "http://sep.ucas.ac.cn/portal/site/226/821"; $ch = curl_init($url); //初始化 curl_setopt($ch, CURLOPT_HEADER, 1); //不返回header部分 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //返回字符串,而非直接输出 //curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file); //存储cookies curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file); //存储cookies $data = curl_exec($ch); curl_close($ch); $url = "http://sep.ucas.ac.cn/portal/site/226/821";