开发者

Need help sending custom info to php global vars

开发者 https://www.devze.com 2023-02-10 02:47 出处:网络
Is is possible to send custom information to $_SERVER[REMOTE_ADDR]; or $_SERVER[HTTP_X_FORWARDED_FOR]; ?

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消