当前位置: 首页>>代码示例>>PHP>>正文


PHP UserAuth::checkUserSession方法代码示例

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

开发者ID:GPHofficial,项目名称:urimg,代码行数:26,代码来源:weather.php


注:本文中的UserAuth::checkUserSession方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。