jquery - How to update database from other site periodically using php?

252

Say my site lists items from other sites, for example, I listed ebay items, what I want to do is when the ebay items be sold out the corresponding item info on my site can be updated, how can we do this using php?

Of course we can start a scheduled process on the hosting server, however we don't have privilege to do that for we only have spaces to host php and mysql.

Any help is highly appreciated!

956

Answer

Solution:

If you can't run CRON on your server, then you can have another server run it for you. As long as your database is accessible to the outside, you can run some CRON from another server or run an application (like a NodeJS script) to grab the external site's data and update your database.

Or better: Find a hosting space that allows CRON jobs or ask your admin for that privilege.

98

Answer

Solution:

You can write a script that runs when you open the url to it, and then you open the URL yourself on specific times. I suppose you could even automate that on your desktop computer. Another option is to write a PHP script that loops and sleeps for an x amount of time, say 8 hours, and loops again to import the data.

177

Answer

Solution:

You need to set up cron job.

You can use free service like: https://www.setcronjob.com/

You set up create special page, accessed by cron service which do all the work (list ebay items, etc.)

658

Answer

Solution:

well say we carry on with the ebay example. would need direct database connection details to the ebay DB Or there would need to be an API to that data. If there was an API you could check every page load like most websites.

People are also looking for solutions to the problem: php - Not all eligible encoding using htmlentities

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.