Hello Friends i decided to post some tutorials on PHP and HTML5 from today.I hope you will enjoy this.
If you are not having the knowledge of PHP.Then follow our blog you will surely learn PHP from here
So my first tutorial is how to get the visitor IP Address using PHP.
We Always think how the websites grab our IP Address when we visit them. So today by this tutorial i will totally explain the reason or we can say that coding behind it.
To Do So First of all create a conf.inc.php file as i shown in the the screenshot.
Remember: Save all the the files on www folder where your wamp server is installed.
In this Screenshot:
Step(1):In first Line We Can Start PHP(we all know that php starts with "
Step(2):In second step we can create a variable with name "$ip_address".This Variable help us in grab the ip address.
Step(3):In third step we can close the PHP By Using "?>".
Now We can create a index2.php file and call conf.inc.php file on it.see the screenshot below.
Step(1):In first line start PHP.
Step(2):In second line here we can use a function(require) and call the conf.inc.php file on it.
Step(3) in last line we can use "echo" which is use to print. same as we can use "printf" in c and "cout" in c++
Now start your wamp server and call the index.php file.((Like http://localhost/index2.php))
Because we are working on local host so our browser shows the ip address 127.0.0.1 See Screenshot Below.
So here is the answer of your question that how the website owner grab your ip address.
I hope you like my post.Wait for my another tutorial or Subscribe us.Leave a comment below if you are having any query.
No comments:
Post a Comment