drupal_http_request returns error code

谁说我不能喝 提交于 2020-01-15 20:23:53

问题


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

Example 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 :

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

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.


回答1:


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.



来源:https://stackoverflow.com/questions/23670926/drupal-http-request-returns-error-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!