drupal_http_request返回错误代码 [英] drupal_http_request returns error code

查看:195
本文介绍了drupal_http_request返回错误代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have three website Main ,a, b. If you logged in through "Main" website then i will enable session for websites "a", "b". So this is working fine. When user logged out of Main Website, i have to loggout of other two website "a", "b". There are two different logout url for the other two website so i am calling those two website's logout url in the Main website's logout function using drupal_http_request

示例CODE:

// 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); 
}


}

OUTPUT: / p>

OUTPUT :

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

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

当我在浏览器选项卡中运行这个注销url时,所有的会话和cookie被销毁,但是当我运行这个注销url使用drupal_http_request(' http://B-website.com:8083/VideoBook/signout.action '); ,则会导致错误Error Opening Socket ssl://。提前致谢。

When i run this logout url in the browser tab , then all the session and cookies are destroyed , But when i run this logout url using drupal_http_request('http://B-website.com:8083/VideoBook/signout.action'); , then it results in error "Error Opening Socket ssl:// " . Thanks in Advance.

推荐答案

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

Basically, the signout.action requires session data i.e currently logged in user details but we are not able to send the session data through the curl. so its redirecting to the login.action. So it results in error code 302.

这篇关于drupal_http_request返回错误代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆