How to keep my html running after a php download

Asked

Viewed 27 times

-1

I need to keep an HTML/PHP page refreshing 1 in a minute checking if any new boleto has been issued, if you have new boleto runs the PHP program creating the database file and downloading to the micro local (the bank’s robot picks up this file automatically). It turns out that after downloading the HTML/PHP stops running. I know I can solve with Ajax just don’t know how. The database program is installed on a Windows local machine and the boletos are on a Linux server in the cloud.

  • Thanks Augusto, but in my case the HTML/PHP page will be running alone 24H and one minute she tests if it was issued some boleto, all without human intervention, if it is issued she downloads the boletos file to be sent to the bank, That’s when the page stops. While there is no file to download it is active (refresh), after downloading it "dies"

  • How would work this PHP script that will be running alone 24H. The PHP script only works if there is a client connected, if the client that started the script ends the connection the server terminates the session. PHP is single threaded if you leave the script in loop it will block the other requests.

  • The way you described the problem would not be the case to use a task schedule with the Cron. The cycle would be the following, Client: enters the site -> Client: click on the button to search for boletos that sends a request-> Server: schedule a boleto search script in Cron to be executed in 1min, Cron: regardless of whether or not there is activity on the server after 1min activates the boleto search script, Boleto Search: if you did not find boletos agenda in Cron to be executed in 1min,.... Boleto: if I find boletos launches in the Database.

  • But if you insist with the idea of mater a connection for 24h see: What is long Polling? and see How websocket works in php

  • Good afternoon. Sometimes we are focused on a complex solution and in the end the solution is very simple. I solved my problem by placing the download program inside an iframe in HTML. html is reloading with refresh of one in a minute and php within iframe is always running. Thank you all.

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.