本文整理匯總了PHP中Connect::parseName方法的典型用法代碼示例。如果您正苦於以下問題:PHP Connect::parseName方法的具體用法?PHP Connect::parseName怎麽用?PHP Connect::parseName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Connect
的用法示例。
在下文中一共展示了Connect::parseName方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getName
public static function getName($number, $pwd)
{
$data = "USERNAME={$number}&PASSWORD={$pwd}";
$result = parent::getHtml(self::LOGIN_URL, $data);
if (strpos($result, self::SUCC_KEY) !== false) {
if ($result = parent::getHtml(self::INFO_URL, $data)) {
return parent::parseName($result, '當前用戶:', '</td>');
}
}
return false;
}
示例2: getName
public static function getName($number, $password)
{
$data['svpn_name'] = $number;
$data['svpn_password'] = $password;
$base = 'https://221.238.246.69:443';
$url = 'https://221.238.246.69:443/por/login_psw.csp';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_USERAGENT, 'AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1');
#獲取cookie
$content = curl_exec($ch);
if (preg_match('/Set-Cookie:(.*);/iU', $content, $matchs)) {
self::$_cookie = $matchs[1];
}
#設置cookie
curl_setopt($ch, CURLOPT_COOKIE, self::$_cookie);
#登錄VPN
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
unset($data);
curl_exec($ch);
#登錄失敗的判斷
#登錄urp
$urp['Login.Token1'] = $number;
$urp['Login.Token2'] = $password;
curl_setopt($ch, CURLOPT_URL, 'https://221.238.246.69:443/web/1/http/0/urp.nankai.edu.cn/userPasswordValidate1.portal');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($urp));
curl_exec($ch);
#設置默認主題
curl_setopt($ch, CURLOPT_URL, 'https://221.238.246.69:443/web/1/http/0/urp.nankai.edu.cn/themeAndSkinSave.portal?themeAndSkin=default_nankai/default');
$content = curl_exec($ch);
// echo $content;
#獲取信息
curl_setopt($ch, CURLOPT_URL, 'https://221.238.246.69:443/web/1/http/0/urp.nankai.edu.cn/index.portal');
$content = curl_exec($ch);
// echo $content;
#關閉curl
curl_close($ch);
return parent::parseName($content, '>歡迎您:', '</li>');
}