Can a PHP script run regularly on the server without requests from the client?

I will write a script to parse text documents into a MySQL database. I will convert PDF to text using a separate utility. These PDF files will be sent via email attachments.

I am looking to see if I can do this with PHP, as the language of the server I'm most familiar with. The second option is Perl, but I will take your recommendations.

Thus, the language should be able to:

  • Check your email account for attachment emails (every few minutes or so).
  • Save the attachment.
  • Parse a file (search for contact information) using regular expressions.
  • And put the results in the MySQL database

I will not have full access to the server, as it will be hosted by GoDaddy or similar.

I am familiar with PHP, but I can’t think of how he would systematically check the mailbox. If PHP cannot do this, are there languages ​​that constantly work on a server that performs tasks without requests from a browser?

Thank.

+3
source share
5 answers

You can do this with a PHP script controlled by a cron job .

+9
source

You can regularly run HTTP requests using a service, such as http://www.setcronjob.com/

+4
source

PHP .

cron (shell, perl, PHP, python.. ..).

IIS, Schedule Tasks Windows.

+3

- . , , PHP script CLI php.

script , , , , ... , /.

+1

Source: https://habr.com/ru/post/1727726/


All Articles