Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

beginner question

Status
Not open for further replies.

advait75

Programmer
Oct 5, 2002
48
IN
Hi,
I am new to PHP. I have the following code, which executes a command line netstat command and removes the headers and replaces white spaces with commas -
<?php
exec('netstat -n', $sts); //Runs the Netstat Command
unset ($sts[0]); //Removes the first line (Headings)
unset ($sts[1]); //Removes the second line (Arb Info)
$sts=preg_replace('/ +/', ',', $sts); //Removes white spaces and replaces with commas
?>
What I want to do is to put the final output into a file called c:\test.csv
Can someone please complete the aboce code for me to do this?
 
You can do that with PHP.

However, the file (test.csv) will end up on the servers c:\ drive -not on the client's .... is this really what you want to do?

Regards


Jakob
 
That's ok if the file is on the server. I don't need it on the client's machine.
thanks.
 
ie. the active connections on the server ... ?

Regards


Jakob
 
Yes I will run that php script from the command line as a scheduled task on the server.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top