I've already read this help, but I think it's incomplete for my goal.
With this help, when my token is out of date, I have to regenerate a token and modify my proxy.php file and the config file of my jsapi based application.
The goal that I reached, is to have a php script that auto-generate a token when my application asked it to.