Hi, I have developed a SMS Application. There is a file name my.php I want to execute it after every 10 seconds so I can get new files which arrive. please guide me
ayesha789 7 Posting Pro in Training
Recommended Answers
Jump to PostYou can run it through the task scheduler, but I think you can only specify per 5 minutes as smallest interval.
Jump to PostYou can create a deamon to run indefinitely, and have it invoke your file every few minutes.
Simple version:
<?php while(1) { sleep(10*60); include('my.php'); } ?>
It will need to be run from the command line. Example:
php deamon.php
Jump to PostIt is best to use the command line. However, you can use the browser.
If using the browser, two things to remember:
1) The webserver will timeout, or browser/client will timeout.
2) The page will have to stay openTo prevent the server from ending the PHP process …
All 9 Replies
pritaeas 2,211 ¯\_(ツ)_/¯ Moderator Featured Poster
ayesha789 7 Posting Pro in Training
pritaeas 2,211 ¯\_(ツ)_/¯ Moderator Featured Poster
Borzoi 24 Posting Whiz
ayesha789 7 Posting Pro in Training
ayesha789 7 Posting Pro in Training
digital-ether 399 Nearly a Posting Virtuoso Team Colleague
ayesha789 7 Posting Pro in Training
digital-ether 399 Nearly a Posting Virtuoso Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.