title: How to prevent cross-domain ajax requests?
body: <p>How can I detect if my php script is being called from another domain and the other domain is making illegal use of my script? Is there a way to prevent this too? </p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I found <a href="https://stackoverflow.com/questions/4929432/how-server-can-check-ajax-requests-not-from-site-x-requested-with">this</a> question on SO, but its still not safe, it can be spoofed.</p>