How to check if a request if coming from the same server or different server?

后端 未结 4 1966
北海茫月
北海茫月 2020-11-29 03:03

How can I check whether a request being received is sent from the same server??

Say, I\'ve my domain at www.domain.com. Now I\'ve php processing files which will pro

4条回答
  •  無奈伤痛
    2020-11-29 03:43

    I know this is an old thread, but some one else can probably find it relevant.

    The answer is: Yes you can. But it depends if your Apache/nginx server is set to populate the $_SERVER variable with the required information. Most the server are, so probably you can use this approach.

    What you need to do is to extract the HTTP_REFERER from the $_SERVER variable and compare with your domain.

提交回复
热议问题