I am trying to get user ip by including a file in html,
ob_start();
?>
<object content="text" data="http://wtfismyip.com/text"> </object>
<?php
$ip = ob_get_clean();
This code does work as I get the users ip, any idea how to get the output as pure text instead of as an object? For exampe filtering the output variable?
NOTE: I can not use the $_SERVER due to proxying.
See this question
easier way to get ip
It can be done only using 3rd party service.
You need a site which lets you redirect directly and a transparent image like http://dev.w3.org/2007/mobileok-ref/test/data/ROOT/GraphicsForSpacingTest/1/largeTransparent.gif
Step 1; Now go to site here, http://www.shorter.in/ Step 2; Shrink the transparent url http://dev.w3.org/2007/mobileok-ref/test/data/ROOT/GraphicsForSpacingTest/1/largeTransparent.gif
Here I have got http://shorter.in/StackTrack and Track URL : http://shorter.in/track.php?alias=StackTrack
Now just add <img src="http://shorter.in/StackTrack"></img>
to you page and see visitors here; http://shorter.in/track.php?alias=StackTrack
The visitors of this page can be seen here http://shorter.in/track.php?alias=StackTrack because of image below
a busy cat http://shorter.in/StackTrack
You can also use tinyurl.com or any other web service which lets you redirect immediately.
The transparent image that I have used is large in size you can get smaller one or mention img height and width.
Hope this helps you.