S
S
Sergey Larin2018-04-19 11:33:30
PHP
Sergey Larin, 2018-04-19 11:33:30

Is it possible to change the value of $_SERVER['REMOTE_ADDR'] on a local php server?

I am making a website on which the content should adjust to the region from which the user comes. I define the region from $_SERVER['REMOTE_ADDR'] , is it possible to change the value of $_SERVER['REMOTE_ADDR'] when starting the local php server (php -S localhost:8000) to see how the site will be displayed to different users?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Melkij, 2018-04-19
@sergeylarin101

Hang an additional IP on the interface, move the web server there and refer to this address.
Or corny to stick $_SERVER['REMOTE_ADDR'] = 'any another ip'; somewhere before checking. $_SERVER is not write protected. Just don't forget to delete before committing.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question