title: How I can get origin of request with PHP?
body: <p>If someone send XHR request from <code>some-client.com</code> to <code>some-rest.com</code>, I want get origin(<strong>domain name, not client ip</strong>) of the request with PHP.</p>
  
  <p>The possible solutions:</p>
  
  <ul>
  <li>Maybe I can use <code>$_SERVER['HTTP_ORIGIN']</code> but I don't know if it is a standard.</li>
  <li>I see another header like <code>$_SERVER['HTTP_HOST']</code> or <code>$_SERVER['SERVER_NAME']</code>, but some cases this return the real <code>hostname</code> and not the real <code>domain</code>.</li>
  <li>And <code>$_SERVER['REMOTE_ADDR']</code> gives the client IP.</li>
  </ul>
  
  <p>Whats is the correct way to get origin of request like a domain name with PHP?</p>
  
  <p>Thanks!</p>