本文整理汇总了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>');
}