I want to write output of command in to php file.But when I open file only one line of output is written.
  $myfile = fopen("status1.txt", "a+"); 
  $cmd="asterisk -rx 'sip show peers'|greo OK";
  $test1=system($cmd);
  fwrite($myfile, $test1);
  fclose($myfile);
OUTPUT is
1004  /1004     (Unspecified)                            D                 0         OK                                  
1005  /1005     (Unspecified)                            D   N             0         OK                                  
1006  /1006     (Unspecified)                            D   N             0         OK                                  
2501  /2501     (Unspecified)                            D                 0         OK                                  
2502  /2502     (Unspecified)                            D   a             0         OK                                  
2503  /2503     (Unspecified)                            D   a             0         OK                                  
2504  /2504     (Unspecified)                            D                 0         OK  
But In file only first line is written
 
     
    