I have multiple subdomains like domain1.example.com, domain2.example.com. I have central database for these subdomains; and i create session for each subdomain when i login (through ajax).
Now i want when i logout from any subdomain, then i logout from all the subdomains (session_destroy) where the session has been created. (I have the list of subdomains where session is maintained). Plz help how to logout from multiple subdomains using cURL.
I am using the following cURL code in loop for subdomains.
$url = 'http://' . $a_domain . ".localhost/panels/login?task=logout";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
Moreover when i directly run the $url in browser, it works and logout from that subdomain, but i want to work it in loop throug cURL. ??
The remote subdomain $URL logout code
public function logout(){
echo '<br>before destroy <br>';
print_r($_SESSION);
session_destroy();
echo'<br>after destroy <br>';
print_r($_SESSION);
}