execute a php script without a cron job?
Moderator: General Moderators
- SmokyBarnable
- Forum Contributor
- Posts: 105
- Joined: Wed Nov 01, 2006 5:44 pm
execute a php script without a cron job?
I had a small php program that checked my email via cron job every 60 seconds. My isp just told me I can't do it that often. Is there any way to have a php script run forever on a server without a cron job?
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Code: Select all
set_time_limit(0);
ignore_user_abort(1);
while(1)
{
// Yay I will never end unless you kill the process!!
//sleep sleep for 60 seconds
sleep(60);
}- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
- AKA Panama Jack
- Forum Regular
- Posts: 878
- Joined: Mon Nov 14, 2005 4:21 pm
Download...
http://www.bitfolge.de/pseudocron-en.html
And then add...
something like this
to every page on your website.
But then again now that I think about it you are doing something really strange.
Why aren't you using an email client that checks your email every second instead of doing it on the server?
http://www.bitfolge.de/pseudocron-en.html
And then add...
something like this
Code: Select all
include ("pseudo-cron/pseudo-cron.inc.php");But then again now that I think about it you are doing something really strange.
Why aren't you using an email client that checks your email every second instead of doing it on the server?
- SmokyBarnable
- Forum Contributor
- Posts: 105
- Joined: Wed Nov 01, 2006 5:44 pm
It just checks to see if any of my ebay auctions have any new sales and then sends an end of auction email to the bidder. I would do it with the above method but ebay limits the amount of api calls you can have per month. So parsing end of auction emails was the only way I could figure to trigger an api call.....but my isp didn't like it much.Why aren't you using an email client that checks your email every second instead of doing it on the server?
- AKA Panama Jack
- Forum Regular
- Posts: 878
- Joined: Mon Nov 14, 2005 4:21 pm
Then why don't you just process them once every 30 minutes? That should be soon enough and most hosting companies that have limits on how often cron tasks can be run allow that.SmokyBarnable wrote:It just checks to see if any of my ebay auctions have any new sales and then sends an end of auction email to the bidder. I would do it with the above method but ebay limits the amount of api calls you can have per month. So parsing end of auction emails was the only way I could figure to trigger an api call.....but my isp didn't like it much.Why aren't you using an email client that checks your email every second instead of doing it on the server?