SQL JSON – Automatically Adding Data from JSON to SQL

jsonsql

I'm really new to this sort of stuff; my background is in C# mainly. Could anyone point me in the right direction?

I need to set a script to automatically parse some JSON into an SQL database whenever the data has been updated on the server.

I look at this file first which returns the file location for the data and the last modified time stamp: http://us.battle.net/api/wow/auction/data/medivh.

I've spent the last hour googling, but I can't find an adequate answer. To summarise, the script needs to run every 15 minutes or so, check if the timestamp changed and if so, and pull the new data and enter it into an SQL database.

Do I need to use PHP to parse and insert the JSON data into the database? If so, how do I manage to run the PHP code every x minutes?

Best Answer

Parsing JSON: Assuming that you are on 5.2.x or above, you can use json_decode to parse the json data.

As for executing the script every x minutes, read up on cron jobs.

Edit: Answer is based on the assumption that you are on Linux and want to do this in PHP.

Related Topic