There are various types of access token for facebook app. The best article that explains them is How to handle access tokens with Facebook SDK v4.0 by Sammy Kaye. To post article / item / product from our own website to facebook fan page, we need to use Page Access Token.
The initial token can be obtained from Facebook Graph API tool. However, that is just a short-lived access token, which will expire in an hour or two after generation. We need to made a Graph API call to get a long-lived access token, which has two months expiry date. Lastly, get a permanent access token, which will never expire and can be used in our daily script.
We can test our script using short-lived access token, but then you have to regenerate another token after expiration. So we should directly get permanent access token before writing our script.