H
H
havemanyquestions2019-08-11 23:46:56
Web servers
havemanyquestions, 2019-08-11 23:46:56

Is it possible to change the ip address in $_SERVER?

Hello. There is a certain script (API) to which it is possible to address from outside.
It is necessary to restrict access by IP. Option two. The first one is through the framework (Laravel, Request). The second is through htaccess.
In the first case, the data is taken from the $_SERVER superglobal array.
I would like to implement the first method.
Question: are these methods equivalent, is it possible to change the IP that comes in $_SERVER? Would htaccess be a more reliable way?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
ThunderCat, 2019-08-12
@havemanyquestions

Question:
Actually two...
Are these methods the same?
almost equivalent
is it possible to change the IP that comes in $_SERVER? Would htaccess be a more reliable way?
The IP address cannot be changed, but you can use a proxy, in which case the address of the real client will be replaced by the address of the proxy server.

D
Dimonchik, 2019-08-12
@dimonchik2013

you can’t change it
, but it may turn out that it’s impossible to make a request from him))) and on the other hand, the medal will have
two sides

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question