开发者

Multithreading in PHP

开发者 https://www.devze.com 2022-12-28 02:46 出处:网络
I am working on windows. I have built a twitter application using the twitter API which periodically checks for new tweets as well as allows users to update their status. I have written separate PHP f

I am working on windows. I have built a twitter application using the twitter API which periodically checks for new tweets as well as allows users to update their status. I have written separate PHP files for reading (reader.php) and writing tweets (writer.php). The only problem is how d开发者_如何学运维o I periodically read the tweets. There are a few ways which I can think of -

1) Use a time-based job scheduler (like Cron) to periodically run the reader.php. How do I do this?

2) Use multithreading to run both reader and writer.php and use a timer function in reader.php

Suggestions?


Since you are working within Windows, you probably won't be able to use cron very easily. You can however, use the task scheduler. See this link for step-by-step instructions.


Another option is to use some kind of job queuing system. The Zend Server Job Queue has the ability to schedule recurring tasks. I use it on my site for an awful lot of stuff. Actually, a lot of what you are trying to do. It does periodic Twitter searches, processes relationships and such. I have a posting about how to use it at Do you queue? Introduction to the Zend Server Job Queue

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号