There is sql, the table in which url is registered, for pictures. How can you implement a script in php that will constantly download images from a table if the table contains links to the images themselves?
1 answer
In the implementation of the download you can help one of the solutions: Curl , fopen , file_get_contents .
file_put_contents("myfile.zip", fopen("http://example.com/file.zip", 'r')); To implement a download table check, you need to write a daemon or a script that starts over the crown every n-time, which will check the table and memorize the last id that was processed. Perhaps the simplest solution is to add a field to the state table, which will display the state of the file (NEW, WORK, DONE, FAILED) and choose to download all the files that are NEW.
Such tasks are usually solved in multi-threaded solutions through a queue of tasks (for example, RabbitMq), the script is writing to the database, picked up in a queue and throwing tasks that workers (consumers) receive.