Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/259.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php drupal_http_请求返回错误代码_Php_Sockets_Drupal_Curl_Drupal Hooks - Fatal编程技术网

Php drupal_http_请求返回错误代码

Php drupal_http_请求返回错误代码,php,sockets,drupal,curl,drupal-hooks,Php,Sockets,Drupal,Curl,Drupal Hooks,我有三个网站主,a,b。如果您通过主网站登录,那么我将为网站a、b启用会话。所以这很有效。当用户从主网站注销时,我必须登录另外两个网站a、b。另外两个网站有两个不同的注销url,因此我使用drupal_http_请求在主网站的注销函数中调用这两个网站的注销url 示例代码: // this is the function where main website session are destroyed function mymodule_logout(){ session_destory()

我有三个网站主,a,b。如果您通过主网站登录,那么我将为网站a、b启用会话。所以这很有效。当用户从主网站注销时,我必须登录另外两个网站a、b。另外两个网站有两个不同的注销url,因此我使用drupal_http_请求在主网站的注销函数中调用这两个网站的注销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:


当我在浏览器选项卡中运行此注销url时,所有会话和cookie都将被销毁,但当我使用drupal_http_request;运行此注销url时,然后,它会导致打开套接字ssl:///时出错。提前谢谢

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

找到curl后,无法连接到主机错误检查您的主机连接Rahesh Sharma。谢谢你的回答,我听不懂。你能简单地解释一下吗?我也面临着同样的问题,如果有人对此有任何解决方案,请分享。