本文整理汇总了PHP中UserAuth::checkUserSession方法的典型用法代码示例。如果您正苦于以下问题:PHP UserAuth::checkUserSession方法的具体用法?PHP UserAuth::checkUserSession怎么用?PHP UserAuth::checkUserSession使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserAuth
的用法示例。
在下文中一共展示了UserAuth::checkUserSession方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: UserAuth
<?php
require_once "userAuthentication.php";
$SessionID = $_GET['SessionKey'];
$auth = new UserAuth($SessionID);
$SessionResult = $auth->checkUserSession();
if ($SessionResult[0]) {
$geolocation = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $_SERVER['REMOTE_ADDR']));
$APIURL = 'http://www.webservicex.net/globalweather.asmx/GetWeather' . '?CityName=' . urlencode($geolocation['geoplugin_city']) . '&CountryName=' . urlencode($geolocation['geoplugin_countryName']);
$client = new SoapClient('http://www.webservicex.net/globalweather.asmx?wsdl');
$params = array("CityName" => $geolocation['geoplugin_city'], "CountryName" => $geolocation['geoplugin_countryName']);
$xml = $client->GetWeather($params)->GetWeatherResult or die("Cannot get weather results");
$xml = mb_convert_encoding($xml, "UTF-16", "UTF-8");
$XMLObject = simplexml_load_string($xml);
echo json_encode($XMLObject);
//Invalid XML given by API
//http://stackoverflow.com/questions/6284548/document-labelled-utf-16-but-has-utf-8-content-in-entity-php-error
//http://php.net/manual/en/function.mb-convert-encoding.php
//http://stackoverflow.com/questions/14869227/php-simplexml-parsing-issue
// $geolocation = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=8.8.8.8'));
//$xml = preg_replace('/(<\?xml[^?]+?)utf-16/i', '$1utf-8', $xml);
// echo $XMLObject->Location;
} else {
echo 'Authentication Failed.' . $SessionResult[1];
}
?>