Example:
A website with url https://website1.com
requests a script
from https://website2.com
. In order to allow access to the script
, an id
must be passed as a parameter to the request:
<script type = "application/javascript" src = "//website2.com/?id=a0cF-p8v"></script>
Now, Website2
uses the id
to get from the database the URL of the website it belongs to. Then, it compares the URL fetched from the database to the one I'm trying to get.
Questions:
Is there a (foolproof) way to get the URL of a website requesting a script with
PHP
?Is this concept actually secure?