- $url = ";//Square Educational system login Address
- $ID = ";
- $PA = ";
- $cookieid = Get_sessionid ($url);//Get the session ID of the login page
- /*
- Is_login () function to determine if the login was successful
- */
- function Is_login ()
- {
- Global $url, $ID, $PA, $cookieid;
- Preg_match (' #value = ' ([^ ']+) ' # ', Curl_get ($url), $VI);
- $p = ' __viewstate= '. UrlEncode ($vi [1]). ' &tbyhm= '. $ID. ' &tbpsw= '. $PA. ' &ddlsf=%d1%a7%c9%fa&imgdl.x=39&imgdl.y=13 '; Default Student
- $co = Curl_get ($url, $p, 0, 0, 0, array (' cookie:asp.net_sessionid= '. $cookieid));
- Curl_get (' Address/xsleft.aspx?flag=grxx ', array (' cookie:asp.net_sessionid= '. $cookieid)); This address must be accessed before obtaining basic information
- Return Strpos ($co, "/xsmainfs.aspx?xh=". $ID)? True:false;
- }//Bbs.it-home.org
- function Curl_get ($url, $add _arry_header = 0)
- {
- $ch = Curl_init ($url);
- curl_setopt ($ch, Curlopt_httpheader, Array (' user-agent:mozilla/5.0 (iPhone; U CPU iPhone os 3_1_2 like Mac os X; En-US) applewebkit/528.18 (khtml, like Gecko) version/4.0 mobile/7d11 safari/528.16 '));
- if ($add _arry_header)
- {
- curl_setopt ($ch, Curlopt_httpheader, $add _arry_header);
- }
- curl_setopt ($ch, Curlopt_returntransfer, true);
- $get _url = curl_exec ($ch);
- Curl_close ($ch);
- return $get _url;
- }
- function Get_sessionid ($u)//Get the session ID of ASPX
- {
- $a = get_headers ($u);
- $a = str_replace (Array ('; ', ': '), ' & ', $a [6]);
- Parse_str ($a, $AA);
- return $AA [' Asp_net_sessionid '];
- }
- ?>
Copy CodeDescription: Code is not fully available, just reference, record. The login address of the square educational system also has the default4.aspx thin login box, the simulation should be simpler. >>> more PHP Demo login articles, featured links: PHP Emulation login PHP Curl Demo Login Tutorial Daquan |