I'm creating a REST API, so basically one api key only valid for one domain,
example : api_key 0kjs9s9s9 only valid for mysite.com
this is for security purpose, so 0kjs9s9s9 only will be able to accessed from mysite.com.
So the question, how to get the domain name who access the page ?
when i print, print_r($_SERVER)
, i only get one information about who are request the page, 'REMOTE_ADDR', and it's an IP. after reading from some place, i find, that i can use gethostbyaddr($_SERVER['REMOTE_ADDR'])
but i'm not sure it's the right way.
please any body give me and example code for this issue.
How if mysite.com is running under proxy and load balancer farm ? which IP i will get ? the proxy or the domain ?
Is some one can send request with fake domain ?
Thanks in advance