inversesoft123 Posted July 1, 2011 Share Posted July 1, 2011 Hello PHP freaks.. Can anybody tell me how to terminate shell script after specific interval time while calling it from php using exec() ? In other words suppose i wanna run $ ngrep -lqi -p -W none ^get\|^post tcp dst port 80 as <?php $records = exec("ngrep -lqi -p -W none ^get\|^post tcp dst port 80"); ?> How can I set timer to expire this code after 4-5 seconds ? I might be thinking or going to wrong way,, But I am planning to create online protocol analyzer / url sniffer. This code monitors incoming and outgoing GET or POST requests.. I am creating code to sniff video URL from video link. any Idea "? Thanks in Advance.. Quote Link to comment https://forums.phpfreaks.com/topic/240861-protocol-analyzing-using-php/ Share on other sites More sharing options...
xyph Posted July 1, 2011 Share Posted July 1, 2011 PHP is an odd language to do this in. win - http://www.php.net/manual/en/function.exec.php#59428 unix - http://www.php.net/manual/en/function.exec.php#89716 Quote Link to comment https://forums.phpfreaks.com/topic/240861-protocol-analyzing-using-php/#findComment-1237167 Share on other sites More sharing options...
inversesoft123 Posted July 1, 2011 Author Share Posted July 1, 2011 Thanks xyph, Let me know if killing of process with SGKILL or core dump used in that code is safe for server environment.?. Is there any alternative to do this with any other way rather than PHP or this is hypothetical concept ? Thanks again Quote Link to comment https://forums.phpfreaks.com/topic/240861-protocol-analyzing-using-php/#findComment-1237168 Share on other sites More sharing options...
xyph Posted July 1, 2011 Share Posted July 1, 2011 Well, your best bet is to code a command line application that sniffs for you, call it in PHP, and parse the output. Quote Link to comment https://forums.phpfreaks.com/topic/240861-protocol-analyzing-using-php/#findComment-1237173 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.