Magento core url helper allows you to get current url.
To get current url in magento you just need one line of code as below:
ref: public function getCurrentUrl()
$magentoCurrentUrl = Mage::helper(‘core/url’)->getCurrentUrl();
You can also get current url as base64 encoded url as: http://dlvr.it/3MjRqM