I write a simple php script that can calculate equal amount of a currency in other currency (for example BTC->DOGE) and because of changing price i have to update it dynamically (for example every 30 sec) so i used javascript with timer that periodically send ajax query to the php script and get the result...
but because of manage server load and usage of our bandwidth i want others can't use my script and prevent their request to run my script and only my site can run it. my question is how i can implement that?
i read about that use something like tokens in forms and set that in session and every time in the time of page creation token will be generated... but i don't know how to implement it in the javascript?
and also using check ORIGIN in $_HEADER ... but i heard (i don't know is correct or not) that everything in header is not reliable and can be fake
please help
thanks all