【发布时间】:2014-04-14 00:32:58
【问题描述】:
我已按照 this 指南(有修改)使用 lightopenid 登录我的 CI 系统。
我下载了我的 openid.php 文件并将其放在我的根文件夹(应用程序、资产等文件夹所在的那个)。
在登录页面,我有这个代码:
<a href="<?php echo base_url('logingoogle/gmail_login');?>" target="_blank">Login using gmail</a>
我的应用程序/控制器/logingoogle.php 中的代码是这样的:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
Class Logingoogle extends CI_Controller {
function __construct(){
parent::__construct();
}
function index(){}
function gmail_login(){
require_once 'openid.php';
$openid = new LightOpenID(base_url());
$openid->identity = 'https://www.google.com/accounts/o8/id';
$openid->required = array(
'namePerson/first'
,'namePerson/last'
,'contact/email'
);
$openid->returnUrl = base_url('logingoogle/after_login');
$openid->authUrl();
}
function after_login(){
require_once 'openid.php';
$openid = new LightOpenID(base_url());
$login_response = '';
$email = '';
$first = '';
if ($openid->mode) {
if ($openid->mode == 'cancel') {
$login_response = "User has canceled authentication!";
} elseif($openid->validate()) {
$data = $openid->getAttributes();
$email = $data['contact/email'];
$first = $data['namePerson/first'];
} else {
$login_response = "The user has not logged in";
}
}
else{
$login_response = "Go to index page to log in.";
}
$data['user_details'] = array(
'login_response' => $login_response
,'identity' => $openid->identity
,'email' => $email
,'first' => $first
);
$this->load->view('after_login',$data);
}
}
现在,当我单击“使用 gmail 登录”链接时,它会打开一个新的空白选项卡,加载时间为 5 分钟(我已经计时了)。 5分钟后,这个错误以纯文本显示:
致命错误:未捕获的异常“ErrorException”,消息“连接到 www.google.com:443 失败; C:\WebServer\Apache2.2\htdocs\ETO\openid.php:229 中没有错误 堆栈跟踪:#0 C:\WebServer\Apache2.2\htdocs\ETO\openid.php(360): LightOpenID-> request_curl('https: //www.goo...', 'GET', Array, true) #1 C:\WebServer\Apache2.2\htdocs\ETO\openid.php(499): LightOpenID->request( 'https://www.goo...', 'GET', Array, true) #2 C:\WebServer\Apache2.2\htdocs\ETO\openid.php(671): LightOpenID->discover('https : //www.goo...') #3 C:\WebServer\Apache2.2\htdocs\ETO\application\controllers\logingoogle.php(30): LightOpenID->authUrl() #4 [内部函数]:登录google->gmail_login() #5 C:\WebServer\Apache2.2\htdocs\ETO\system\core\CodeIgniter.php(359): call_user_func_array(Array, Array) #6 C:\WebServer\Apache2.2\htdocs \ETO\index.php(206): require_once('C:\WebServer\Ap...') #7 {main} 在第 229 行的 C:\WebServer\Apache2.2\htdocs\ETO\openid.php 中抛出
以前有没有人遇到过类似的错误?我究竟做错了什么?我无法破译给我的错误信息。请帮忙。
【问题讨论】:
标签: php codeigniter login gmail openid