开发者

How to keep PHP script running until it finishes?

开发者 https://www.devze.com 2023-03-04 04:44 出处:网络
I have a script which looks for specific words in environmental news articles. It can process one article, and then maybe five more and then (NO DATA RECEIVED) However, I have to cycle through about 3

I have a script which looks for specific words in environmental news articles. It can process one article, and then maybe five more and then (NO DATA RECEIVED) However, I have to cycle through about 30 RSS Feeds which contain 10 articles each, once per week.

Is there a more robust solution? Or some way to have it process a few and then restart itself?

my colleague suggested I explain what happens in the script.
the script loads RSS Feeds from a list. one by one.
it uses magpie_debug to obtain links, title, dates. 
if the date is less than 60 minutes ago, (fresh article) 
it pulls the plaintext (simple_DOM) attaches POS tags using brill tagger
splits text into sentences.
builds arrays of capitalized nouns, matches them twelve different word banks
including a large database of chemicals, companies etc. and generates an
algorithm of 'total environmental impact' for each sentence.
moves to next sentence in article until completed. 
each article takes about 10 seconds to process. 
Moves to the next article. Until all articles processed.
Moves to next feed until all feeds processed.

I can grab the plaintext of all articles/feeds no problem, but once I throw in the processing, the capability drops dramatically. I get a NO DATA RECEIV开发者_如何学编程ED after about four articles.


I think this is what you're looking for based on the title of your question:

<?php
//set the time limit to infinite
set_time_limit(0);

//do more stuff
?>
0

精彩评论

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