1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xh tml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> </head> <?php
function login_simulation_for_SEU_pt($username,$password,$targetUrl){ $login_url="http://bbs.seu.edu.cn/bbslogin.php?mainurl="; $post_fields="id=".$username."&passwd=".$password."&kick_multi=1"; $ch=curl_init($login_url); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36'); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields); $arr=curl_exec($ch); preg_match_all('/Set-Cookie:(.*);/iU',$arr,$str); curl_close($ch); $cookieForPT=$str[1][1].";".$str[1][2].";".$str[1][8].";".$str[1][4]."; WWWPARAMS=0"; $login_pt_url="http://bbs.seu.edu.cn/pt/login.php"; $post_fields="id=".$username."&passwd=".$password."&CookieDate=&kick_multi=1"; $ch=curl_init($login_pt_url); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36'); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_COOKIE, $cookieForPT); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields); $arr=curl_exec($ch); preg_match_all('/Set-Cookie:(.*);/iU',$arr,$str2); curl_close($ch); $cookie_final=$str[1][0].";".$str[1][1].";".$str[1][2].";".$str[1][4].";".$str[1][5].";".$str[1][6].";".$str[1][7].";".$str[1][8].";".$str[1][9].";".$str2[1][4].";".$str2[1][5].";".$str2[1][6].";".$str2[1][7].";".$str2[1][8]; $ch=curl_init($targetUrl); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/602.2.14 (KHTML, like Gecko) Version/10.0.1 Safari/602.2.14'); curl_setopt($ch, CURLOPT_COOKIE, $cookie_final); $content=curl_exec($ch); curl_close($ch); return $content; } $targetUrl="http://bbs.seu.edu.cn/pt/details.php?id=60608&hit=1"; $username="xxx"; $password="xxx"; $content=login_simulation_for_SEU_pt($username, $password, $targetUrl); var_dump($content); ?>
</html>
|