【问题标题】:drupal_http_request returns error codedrupal_http_request 返回错误代码
【发布时间】:2014-07-03 11:15:30
【问题描述】:

我有三个网站主要,a,b。如果您通过“主”网站登录,那么我将为网站“a”、“b”启用会话。所以这工作正常。当用户退出主网站时,我必须退出其他两个网站“a”,“b”。其他两个网站有两个不同的注销 url,所以我使用 drupal_http_request 在主网站的注销功能中调用这两个网站的注销 url

示例代码:

// this is the function where main website session are destroyed
function mymodule_logout(){ 

session_destory(); 

$request =  drupal_http_request("http://B-website.com:8083/VideoBook/signout.action");

print_r($request); 

if($request) { 
drupal_goto($logout_url,$options); 
}


}

输出:

stdClass Object ( [code] => 0 
[error] => Error opening socket ssl://mywebsite.com:8443 
[redirect_code] => 302 
[redirect_url] => https://mywebsite.com:8443/cas/login?service=http%3A%2F%2Fmywebsite2.com%3A8083%2FVideoBook%2Flogin.action )

B-website-logout-url : http://B-website.com:8083/VideoBook/signout.action

当我在浏览器选项卡中运行此注销 url 时,所有会话和 cookie 都将被销毁,但是当我使用 drupal_http_request('http://B-website.com:8083/VideoBook/signout.action'); 运行此注销 url 时; ,然后它会导致错误“错误打开套接字ssl://”。提前致谢。

【问题讨论】:

  • 发现 curl 无法连接到主机错误检查您的主机连接
  • 拉赫什·夏尔马。感谢您的回复
  • 我听不懂。能简单解释一下吗?
  • 我也面临同样的问题,如果有人有任何解决方案请分享。

标签: php sockets drupal curl drupal-hooks


【解决方案1】:

基本上,signout.action 需要会话数据,即当前登录的用户详细信息,但我们无法通过 curl 发送会话数据。所以它重定向到login.action。所以它会导致错误代码302。

【讨论】:

    猜你喜欢
    • 2011-12-04
    • 1970-01-01
    • 2017-06-03
    • 2016-07-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多