public function login() { $ret = $this->request($this->loginUrl); $form = getASPSessionForm($ret['body']); $form['ctl00$log_username'] = $this->username; $form['ctl00$log_password'] = $this->password; $form['ctl00$logon'] = '登录'; $ret = $this->request($this->loginUrl, $form); $this->sessionId = parseInformation('/ASP.NET_SessionId=([0-9a-z]+)/', $ret['body']); if (!$this->sessionId) { throw new LoginException('Session ID not found.'); } $this->key = parseInformation('/\\?key=([0-9a-zA-Z]+)/', $ret['body']); if (!$this->key) { throw new LoginException('Key not found.'); } }
public function login() { $ret = $this->request($this->loginUrl); $form = getASPSessionForm($ret['body']); $form['ctl00$ContentPlaceHolder1$txtUsername_Lib'] = $this->username; $form['ctl00$ContentPlaceHolder1$txtPas_Lib'] = $this->password; $form['ctl00$ContentPlaceHolder1$txtlogintype'] = 0; $form['ctl00$ContentPlaceHolder1$btnLogin_Lib'] = '登录'; $ret = $this->request($this->loginUrl, $form); $login_error = parseInformation('/ctl00_ContentPlaceHolder1_lblErr_Lib"><font color="#ff0000">([^<]+)</', $ret['body']); if ($login_error) { throw new LoginException($login_error); } $this->cookie = parseInformation('/sulcmiswebpac=([0-9a-zA-Z]+)/', $ret['body']); if (!$this->cookie) { throw new LoginException(); } }