Is is possible to send custom information to $_SERVER[REMOTE_ADDR];
or $_SERVER[HTTP_X_FORWARDED_FOR];
?
I want to make these 开发者_开发技巧vars output my custom text. I thought about editing headers sent by browser or sending it with php script/curl program. But I don't know how. Please tell me if it is possible and how.
You can't change $_SERVER['REMOTE_ADDR']
as that's the IP address of the TCP connection. The only way to change that is to actually connect from a different real IP address.
You can send whatever X-FORWARDED-FOR
header you want in the HTTP request. All that header is used for is to hint that the connecting IP is proxying a request for some other client. It's not relied upon for anything important.
精彩评论