Forum Moderators: coopster

Message Too Old, No Replies

PHP fopen() or file() and headers

Is it possible to open a remote file and change headers sent?

         

planbeta

10:58 am on Jun 23, 2003 (gmt 0)

10+ Year Member



Hello.

I have a php script on my 1st server which is called from a 2nd server using fopen() - I could also use file().

When I look in my access logs for the script on the 1st server the logged IP is that of the 2nd server and not the user who called the page (obviously).

Is there anyway I can capture the users IP and then send this from the 2nd server script to the 1st server script's headers, so in my access logs it shows the IP of the person who access that page and not the the 1st servers IP?

Not sure if I'm making sense here?!

Thanks

Chris

dmorison

11:55 am on Jun 23, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There would be no simple way to make the logs show the IP address of the end user in the usual place, but you could pass it as a parameter, something like:

fopen("http://server1/somescript.php?".$REMOTE_ADDR");

This would mean that you would see the end user's IP address in the log of server1, but only tagged onto the end of the script that was called.

planbeta

1:20 pm on Jun 23, 2003 (gmt 0)

10+ Year Member



Thanks for that idea, it's quite a good but my log analyzer won't work with this, but if all else fails I shall use that method :)

I have found out that you CAN change things like refer,browser header info using scripts like this:

www.bitfolge.de/index.php?l=en&s=befopen&style=winter

You can view the script here:

www.bitfolge.de/download/source/befopen.phps

Would it be possible to modify this script for my needs?

Cheers

Chris

[edited by: jatar_k at 4:34 pm (utc) on June 23, 2003]
[edit reason] delinked [/edit]

daisho

2:32 pm on Jun 23, 2003 (gmt 0)

10+ Year Member



Everything but the remote IP address is a passed variable that you can override. The remote IP that apache/IIS logs comes directly from the TCP/IP connection. If faked then you will not get the response from the server.

daisho.

planbeta

2:48 pm on Jun 23, 2003 (gmt 0)

10+ Year Member



Thanks daisho