Echo Magento Session ID

Echo Magento Session ID

If you’ve set up a Magento installation with multiple domains, it’s quite likely that you’d like to carry sessions over to the different domains. This functionality is built into Magento but isn’t documented very well.

The following snippet of code will obtain the encrypted session ID used by the current session. You can then use this session ID to carry over the session to the other domains.
<?php $sessionId = Mage::getSingleton("core/session")->getEncryptedSessionId(); ?>
A simple example of a link:
<a href="http://www.domain2.com/?SID=<?php echo Mage::getSingleton("core/session")->getEncryptedSessionId(); ?>">Domain 2</a>
Source