Is there a way to retrieve IP address behind a proxy?
Mhaxx 13 7574
Mhaxx <mh***@despammed.com> writes: Is there a way to retrieve IP address behind a proxy?
Sometimes.
$_SERVER['X_FORWARDED_FOR'] works on some of them, not on others.
--
Chris
On Fri, 05 Sep 2003 10:10:25 +0200, Mhaxx <mh***@despammed.com> wrote: Is there a way to retrieve IP address behind a proxy?
this is what I use (doesn't always work:
if ($_SERVER['HTTP_X_FORWARDED_FOR']) {
$ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR']." (through proxy
".$_SERVER['REMOTE_ADDR'].")";
}
else {
$ipaddress = $_SERVER['REMOTE_ADDR'];
}
?>
>this is what I use (doesn't always work:
There isn't $_SERVER['HTTP_X_FORWARDED_FOR'] in my proxy headers! :-((
Are there other ways?
Mhaxx Are there other ways?
Try this, which I picked up from someone else:
# Function to obtain the IP address behind cache
function getRealIp () {
# Obtain the server addresses
#!# These potentially require an isSet
$HCIP = $_SERVER['HTTP_CLIENT_IP'];
$HXF = $_SERVER['HTTP_X_FORWARDED'];
$HXFF = $_SERVER['HTTP_X_FORWARDED_FOR'];
$RMAD = $_SERVER['REMOTE_ADDR'];
# Logic to ascertain which to use
$ipAddress = ($HCIP != '') ? $HCIP :
($HXF != '') ? $HXF :
($HXFF != '') ? $HXFF :
($RMAD != '') ? $RMAD : '';
# Return the result
return $ipAddress;
}
Martin
>Try this, which I picked up from someone else:
Nothing, I always get the IP address of my proxy!
I think that if my proxy doesn't add IPA visitors header into its
headers, I can't obtain IPA visitors.. is it right?
Mhaxx
Mhaxx <mh***@despammed.com> writes: Try this, which I picked up from someone else:
I think that if my proxy doesn't add IPA visitors header into its headers, I can't obtain IPA visitors.. is it right?
Make a PHP page solely containing <?php phpinfo(); ?> View it through
the proxy. Do a search on the page for your real IP. If you can't
find it, the proxy doesn't send it, and no, you can't obtain it. If
you can find it, you should have a big hint as to what the variable
it's in is called.
--
Chris
>the proxy. Do a search on the page for your real IP. If you can't find it, the proxy doesn't send it, and no, you can't obtain it.
I can't see the "real" IPA in phpinfo().
I have no other ways, right? :-°°(
Mhaxx
Mhaxx <mh***@despammed.com> writes: the proxy. Do a search on the page for your real IP. If you can't find it, the proxy doesn't send it, and no, you can't obtain it.
I can't see the "real" IPA in phpinfo().
I have no other ways, right? :-°°(
Well, you could ask the user to type their IP into a box on the page.
It might be possible to use Javascript to grab it client-side and put
it into a hidden field, but that's going to be unreliable at best, and
might _really_ annoy some people (if someone's going out of their way
to keep their IP hidden, trying to find it is going to make them
leave, fast).
Looks like you'll just have to give up on this one.
What do you need the IP for, anyway?
--
Chris
>Well, you could ask the user to type their IP into a box on the page.
No no.. What do you need the IP for, anyway?
To trace accesses to my web site, and (maybe) to trace visitors IPA
when they buy something in my merchant site.. I know what you think:
it's not a good idea, because you can change your IPA if you want, so
it's not a secure way..
Mhaxx What do you need the IP for, anyway?
To trace accesses to my web site, and (maybe) to trace visitors IPA when they buy something in my merchant site.. I know what you think: it's not a good idea, because you can change your IPA if you want, so it's not a secure way..
This will fail. Use sessions instead, which are intended exactly for this
sort of application, and which fairly are simple to set up. www.php.net/session
Martin
>This will fail. Use sessions instead, which are intended exactly for this sort of application, and which fairly are simple to set up.
www.php.net/session
I *use* PHP session!
But I need to retrieve IPA..
Mhaxx I *use* PHP session! But I need to retrieve IPA..
Did you try the function I posted at Fri, 5 Sep 2003 14:01:59 +0100,
reproduced below. I contend that you won't get any further than that in
getting a visitor's IP address.
If that doesn't work, then I'm still not clear what you're wanting to
achieve exactly.
I had thought you wanted some derivative of the client's IP address,
though perhaps IPA is referring to something I'm not familiar with, as
it's not an acronymn I've come across.
To trace accesses to my web site http://www.analog.cx/docs/webworks.html is a good guide to what is and
isn't possible, incidentally.
Martin
# Function to obtain the IP address behind cache
function getRealIp () {
# Obtain the server addresses
#!# These potentially require an isSet
$HCIP = $_SERVER['HTTP_CLIENT_IP'];
$HXF = $_SERVER['HTTP_X_FORWARDED'];
$HXFF = $_SERVER['HTTP_X_FORWARDED_FOR'];
$RMAD = $_SERVER['REMOTE_ADDR'];
# Logic to ascertain which to use
$ipAddress = ($HCIP != '') ? $HCIP :
($HXF != '') ? $HXF :
($HXFF != '') ? $HXFF :
($RMAD != '') ? $RMAD : '';
# Return the result
return $ipAddress;
}
>Did you try the function I posted at Fri, 5 Sep 2003 14:01:59 +0100,
Yes, but with no success. If that doesn't work, then I'm still not clear what you're wanting to achieve exactly.
I only want to get client's IP address!
...but I can't because my web server is behind a proxy, so if I try to
retrieve client's IP address I get proxy's IP address!
I had thought you wanted some derivative of the client's IP address,
No, exactly the IP address.
though perhaps IPA is referring to something I'm not familiar with, as it's not an acronymn I've come across.
IPA = IP address ;-) http://www.analog.cx/docs/webworks.html is a good guide to what is and
I'm connecting to it to see..
Thanx, bye.
Mhaxx This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: demonhunter |
last post by:
Hi,
I am trying to fetch a web content using LWP and HTTP modules behind
corp firewall. I set proxy server as shown in my internet explorer
connection setup.
When i run the script, i got...
|
by: Bill Hauver |
last post by:
I am attempting to use a web service from my work pc
which is behind a firewall. I have used wsdl.exe to
create the web service reference class and added it to my
project. (this seems to work...
|
by: John |
last post by:
Hi
Does anyone have an example of using the Internet Transfer Control from
behind a proxy server on port 8080?
Thanks
Regards
|
by: Yassar |
last post by:
I want my P2P application to works well even when users are behind
proxy or LAN.
i.e Two instance of my application should be able to communicate even
if they are on different LANs but...
|
by: Thomas Miller |
last post by:
Is there ANY way for a windows app to consume a web service by going
through a SOCKS proxy? This is a MUST for me because the windows app I
am building will be deployed to many corporate clients...
|
by: james.dixon |
last post by:
Hi
I have been struggling with what should be a simple thing. I want to
crawl the web for specific links, and save any html and files that meet
my criteria to my hard drive.
I thought that...
|
by: sameer |
last post by:
hi all,
Description of my .net application:
Desktop application using webservices over the internet to communicate with
the sql server2000 database which is sitting behind the webserver.
Done...
|
by: sameer |
last post by:
..NET Framework 1.1
VS2003
Application is making webservice calls from behind a proxy server and then
freezes and dies.
Questoin is can i use webservice over proxy server( i guess another name...
|
by: demotis |
last post by:
I'm working on an internal website and have full control of the web server and php scripts. I do not, however, have the ability to change or modify internet access to allow me to get past the proxy...
|
by: aladdinm1 |
last post by:
Dear all,
I have a client application which working just fine except in one case: when
it's behind a proxy. I tested it behind MS ISA with enabled Socks service. I
tried everything to make it...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |