mercredi 31 août 2016

Update a link every few hours from external URL

I am trying to create a download link on my website which changes every few hours. The URL is stored in a file on another server.

When a user visits the website a script will need to run that does the following: -

  • checks to see if current time is greater or equal to expiring time in the file.
  • If current time is less than expire time then the stored URL will display
  • else it needs to read the latest URL from the API and store it in the variable/file
  • then add a new expiring time of expiring time plus 3 hours

How do I write this script? What does the time format need to be in?

Also does the file that the data is stored in need to be txt or XML?

The first file will be manually created and contains the download URL and an expiring time of current time plus 3 hours.

Help :(

Aucun commentaire:

Enregistrer un commentaire