Magento get ip address
Magento get ip address : Magento Core Http Helper (Mage::helper(‘core/http’)->getRemoteAddr();) class is used to get the current Ip Address in magento. You can get visitors detail using this helper. Magento Core Http Helper class provides useful functions which can be used frequently. In this tutorial we are going to explain the Magento Core Http Helper.
Magento get ip address
Here is syntax to get the ip address of the visitors in magento –
Magento get Remote ip address
Magento get ip address of Visitor
$visitorsIpAddress = Mage::helper('core/http')->getRemoteAddr(); |
The above syntax will give you the visitors ip address in magento. Let us go with other options available in Magento Core Http Helper.
Magento get Server Ip
You Can get Server Ip in magento as below-
Magento get ip address of Visitor
$visitorsServerIp = Mage::helper('core/http')->getServerAddr(); |
Mage::helper(‘core/http’)->getServerAddr(); isused to retrieve server IP address.
Magento Validate Ip Address
You Can Validate Ip Address in Magento as below –
Magento Validate Ip Address
Mage::helper('core/http')->validateIpAddr($ipAddress); |
Mage::helper(‘core/http’)->validateIpAddr(); is used to validate ip address. It returns false if ip address is not valid.
Magento get http referrer
You Can get http referrer in Magento as below –
Magento get http referrer
Mage::helper('core/http')->getHttpReferer($clean = true); |
Mage::helper(‘core/http’)->getHttpReferer(); is used to get http referer in magento.
More Functions In Core Http Helper
Here list of other functions available in Core Http Helper.
Magento Core Http Functions
Mage::helper('core/http')->getHttpHost($clean = true); Mage::helper('core/http')->getHttpUserAgent($clean = true); Mage::helper('core/http')->getHttpAcceptLanguage($clean = true); Mage::helper('core/http')->getHttpAcceptCharset($clean = true); |
You can use the above core http helper to get the details listed above.
Advertisements