Fwd: [PHP] How could I mix popen() and pcntl_alarm() function ?

2010-06-15 Thread Chian Hsieh
nction, and it's work on that example in above URI. In my try and error experiment, I think the SIGALRM does not trigger because we called popen() function. Could anyone help ? Thanks - Arron On Wed, Jun 16, 2010 at 2:38 AM, Jim Lucas wrote: > Chian Hsieh wrote: > > Hi, > &

[PHP] How could I mix popen() and pcntl_alarm() function ?

2010-06-15 Thread Chian Hsieh
Hi, I want to use tail command to tail the file by popen and trigger the function signal() by every 3 secs. Here is my example code: declare(ticks = 1); // Unreachable function function signal($signal) { echo "SIGALRM\n"; pcntl_alarm(3); } pcntl_signal(SIGALRM, "signal"); pcntl_alarm(3); $f

[PHP] Is there a good way to extract the / content in HTML with/without closing tag?

2010-05-23 Thread Chian Hsieh
Hi, I want to extract all contents started with and with/without closing tags. My solution is using a regular expression to get it work, but there is some exception I could not handle out. The REGEXs I used are: // With closing tag if (preg_match_all("#(<(object|embed)[^>]+>.*?)#is", $str, $ma