09 February 2017

Get ip address using PHP


To get the ip address of the visitor / user , use the following PHP code section :

<?php
//returns the ip of the user / visitor
     $ip = $_SERVER['REMOTE_ADDR'];
?>

Here ,  
$ip is the variable which holds the ip address .
$_SERVER is used to get information about server and execution.
 REMOTE_ADDR is the environment variable which holds the ip address of the user.





php

(If you found this article useful then share with your friends.)

No comments: