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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

About ping command

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi!

I have small problem. I want to ping a server and the result shouldn't be printed in the browser window, just become a value.

Here you can see the script that I have:

<?
$command=&quot;ping linux.com -t ttl -c1 | tail -1 | awk '{print $4 \&quot; \&quot; $5}'&quot;;
$output = system($command, $test);
system(&quot;exit(0)&quot;);
echo &quot;DATA: $output&quot;;
?>

When I run this in my browser the resualt will be as follow:

33.1/33.1/33.1 ms DATA: 33.1/33.1/33.1 ms

The echo value is just a test for me to see if the $output value is OK.

What I want is that the value before DATA: 33.1/33.1/33.1 ms
shouldn't be viewed in the browser just DATA: 33.1/33.1/33.1 ms

Could someone please help me with this problem?

Best Regards

Peter Håkansson
 
A little misstake from me:

It should be:

$output = system($command);

NOT

$output = system($command, $test);
 
Check the awk forum please..they can help you with this.
I don't write cgi, otherwise I would try.
 
Use the search facility at the top of the page. Type in awk and make sure that the 'Find a forum' radio button is selected. Good luck.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top