0

I want to know other websites that access my own website

example :

123Website has a popup modal that show web view and call mywebsite.com/ControllerA/functionA

in my website functionA, i want to know this function is access by 123Website.

Is it possible to get the web name or web url that access my website based on case above?

  • 1
    Look at the access log files – RiggsFolly Nov 25 '21 at 08:28
  • @RiggsFolly actually, i want to use "if" base on the website name to make certain condition – lauwis premium Nov 25 '21 at 08:30
  • If you want to disallow access to your page by 123Website you could use [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS). – KIKO Software Nov 25 '21 at 08:32
  • @KIKOSoftware i intentionally allowed it. And try to get website name that access it – lauwis premium Nov 25 '21 at 08:35
  • Depends on whether the server makes the call or the client. If the client does an ajax request then your webserver only sees the public ip of the client. If a server does an request then you either get the domain right there or the ip of the domain. You'll have to do some research on it. None the less. PHP knows who does the request with `$_SERVER['REMOTE_ADDR']`. More details here: [How to get the client IP address in PHP](https://stackoverflow.com/questions/3003145/how-to-get-the-client-ip-address-in-php) – Definitely not Rafal Nov 25 '21 at 08:35
  • Sorry, as far as I know there's no reliable way to get the name of the website in which your page is embedded. This information should come from the client's browser and due to the security, to protect the privacy of the user, information like this is not supplied by many browsers. – KIKO Software Nov 25 '21 at 08:38

0 Answers0