1

I have a json-document on my host called: "weatherData.json". The data in that data is going to be cloned from another page called: "www.example.com/whatWeather.json".

The "wheaterData.json" on my host should be recloned from the external page automaticly every 10 minutes. (I have cpanel if that's make any difference)

What would be the most optimal way to accomplish this?

1 Answers1

0

You can set up a cron job. (In cpanel, there's a link to 'Cron Jobs')

Simplest way to do that is to create a URL that handles the import (I am assuming you are using a framework with some routing capabilities, for example http://yoursite.com/handle-import to point to the import function)

Then set the cron command to

curl http://yoursite.com/handle-import

You also have a nice interface which hepls you set up the recurrence interval (start with the default "every 5 minutes" and just edit the 5 into 10 `

As for the cloning itself, you can check out Saving image from PHP URL

Community
  • 1
  • 1
Alex Tartan
  • 6,736
  • 10
  • 34
  • 45