我正在尝试使用 LightOpenID 获取数据。照原样,下面的代码正在工作,但如果我取消注释这些行以获取更多信息,它会超时并且不会显示任何错误。我究竟做错了什么?
require_once('inc/func/_functions.php');
require ('inc/libs/openid.php');
initSession();
try {
$openid = new LightOpenID('tutordelphia.com');
if(!$openid->mode) {
$openid->identity = 'https://www.google.com/accounts/o8/id';
$openid->required = array (
'contact/email',
// 'namePerson/first',
// 'namePerson/last'
);
header('Location: ' . $openid->authUrl());
} elseif($openid->mode == 'cancel') {
echo 'User has canceled authentication!';
} else {
$valid=$openid->validate();
if($valid)
{
$data=$openid->getAttributes();
$_SESSION['user']=new userClass();
$_SESSION['user']->userID=$_GET['openid_identity'];
$_SESSION['user']->userEmail=$data['contact/email'];
// $_SESSION['user']->firstName=$data['namePerson/first'];
// $_SESSION['user']->lastName=$data['namePerson/last'];
// $_SESSION['user']->userName=$data['namePerson/first'].$data['namePerson/last'];
$_SESSION['user']->addUserToDB();
$_SESSION['user']->createUserCookie();
header('Location: index.php');
}
}
} catch(ErrorException $e) {
echo $e->getMessage();
}