I am trying to get a specific line in a file and then next 2 lines after it. How can I get next 2 lines? The following is my code and file.
$context = 'context=regencyoutgoing';
$lines = file('/etc/asterisk/sip1.conf');
foreach($lines as $line)
{
$find_context = strpos($line, $context);
if($find_context !== false){
echo $line;
}
}
Here is my sip1.conf
:
[000201891]
type=friend
context=regencyoutgoing
username=000201891
callerid = <000201891>
host=dynamic
secret=198
[000202222]
type=friend
context=regencyoutgoing
username=000202222
callerid = <000202222>
host=dynamic
secret=2000