php获取openid数据库识别不出,php – OpenID登录代码在实时服务器中失败

方建明
2023-12-01

我已经解决了问题并找到了解决方法. request()方法进行一些自动检测以找出如何建立HTTP连接:

protected function request($url, $method='GET', $params=array(), $update_claimed_id=false)

{

if (function_exists('curl_init')

&& (!in_array('https', stream_get_wrappers()) || !ini_get('safe_mode') && !ini_get('open_basedir'))

) {

return $this->request_curl($url, $method, $params, $update_claimed_id);

}

return $this->request_streams($url, $method, $params, $update_claimed_id);

}

在我的开发框中使用CURL但在我的实时框中它使用file_get_contents(),因为检查失败.原因是open_basedir指令不为空.

如果我强制LightOpenID使用CURL,一切都运行顺利.

更新#1:LightOpenID在确定卷曲不可用时是正确的.我在日志文件中找到了这个:

CURLOPT_FOLLOWLOCATION cannot be activated when safe_mode is enabled

or an open_basedir is set

至于file_get_contents()版本,我怀疑我在库中发现了一个拼写错误:

Index: lightopenid/openid.php

===================================================================

--- lightopenid/openid.php (0.60)

+++ lightopenid/openid.php (working copy)

@@ -349,7 +349,7 @@

$this->headers = $this->parse_header_array($http_response_header, $update_claimed_id);

}

- return file_get_contents($url, false, $context);

+ return $data;

}

protected function request($url, $method='GET', $params=array(), $update_claimed_id=false)

我已经通知了作者,他确认这是一个错误.我会报告它是否得到修复.

更新#2:2012年6月在master分支中的错误was fixed.它仍然不是稳定版本的一部分,但可以从code repository下载.

 类似资料: