the title for my question is self explanatory.
i want to make a bot like script that run every 10sec and check a website for a news to come or an event.
i heard that i can use cron jobs, but i also heard that run a script in this short period will make my account suspended.
i also thought that if i cant run a script in short period why not to make my php code check the web page over and over in a "for" structure? but i think i will have a problem of "max execution time".
any idea how i can do that?
just a general tip would be appreciated.
[Cron Job] Execute a script every 10sec
Moderator: General Moderators
- Technocrat
- Forum Contributor
- Posts: 127
- Joined: Thu Oct 20, 2005 7:01 pm
Re: [Cron Job] Execute a script every 10sec
You can, but getting your account suspended is a host and script specific thing which no one will be able to answer. If it takes alot of process to run, then probably.
Just google php cron job you will find a number of resources on how to do this. It's pretty strait forward. If you have CPanel and CRON job access it is even easier.
Though I have to ask, the site you want to pull from can really have new items in 10 seconds intervals? That seems really quick and that instant of an update seems impractical. I would think every hour if not more makes more sense.
Just google php cron job you will find a number of resources on how to do this. It's pretty strait forward. If you have CPanel and CRON job access it is even easier.
Though I have to ask, the site you want to pull from can really have new items in 10 seconds intervals? That seems really quick and that instant of an update seems impractical. I would think every hour if not more makes more sense.
Re: [Cron Job] Execute a script every 10sec
thank you very much for sharing your knowledge too me,
and yes it have news in 10 sec. for more detail its a stock market place that have an auction house like page, staff will be inserted by members and a member should check the page continually for a good item with good price to buy.
a friend of mine requested me to build an app for that i mean a local app that run in linux or windows, i done that, but now the problem is the computer should be turn on and be online, with this alot of bandwidth and electric resource will be wasted. so im going to make an improvement to my app by using a host to do my job.
and by the way im looking for 2 main function that my php program should have:
1. i want to login to the website using my friends user and password. so that i can see the auctions.
2. sometimes there is a link in the auction, that i should see that for more detail, so i need my php to look for the page source and find the link and open it and last, get the info in that page. (i had done it so far, but the problem is when i get that page, the destination host will give me a login page with user and pass required, i mean i need to be logged in so that i can get that info, thats i couldn't done so far).
again, any general tips how i can do that will be appreciated. i dont need a perfect code, just a tip.
regards, Elnaz
and yes it have news in 10 sec. for more detail its a stock market place that have an auction house like page, staff will be inserted by members and a member should check the page continually for a good item with good price to buy.
a friend of mine requested me to build an app for that i mean a local app that run in linux or windows, i done that, but now the problem is the computer should be turn on and be online, with this alot of bandwidth and electric resource will be wasted. so im going to make an improvement to my app by using a host to do my job.
and by the way im looking for 2 main function that my php program should have:
1. i want to login to the website using my friends user and password. so that i can see the auctions.
2. sometimes there is a link in the auction, that i should see that for more detail, so i need my php to look for the page source and find the link and open it and last, get the info in that page. (i had done it so far, but the problem is when i get that page, the destination host will give me a login page with user and pass required, i mean i need to be logged in so that i can get that info, thats i couldn't done so far).
again, any general tips how i can do that will be appreciated. i dont need a perfect code, just a tip.
regards, Elnaz
Re: [Cron Job] Execute a script every 10sec
I don't think a cronjob will be of any use here since you will have to refresh the page every 10 sec anyway to see if there's something new. I think the best thing to use is ajax.
Re: [Cron Job] Execute a script every 10sec
if you read the post carefully, you will realize that there is no request from client, so that i cant use ajax.
just one thing still is mysterious, how i can read a html source when it require you to login.
so far, i posted the user and password to the page (the page that action properties of the login form mentioned) and then trying to open the report page.
but it seems it will show me the login source again.
just one thing still is mysterious, how i can read a html source when it require you to login.
so far, i posted the user and password to the page (the page that action properties of the login form mentioned) and then trying to open the report page.
but it seems it will show me the login source again.