You are here: Formatting Output From passthru() Command « All PHP « IT news, forums, messages
Formatting Output From passthru() Command

Posted by Regan on 04/05/06 22:41

Hello,

I was wondering if there is a way to format the output from the
passthru() command. What I have right now is the following:

$content = passthru("ping -c 4 192.168.0.2", $err);

When I echo $content I get the following:

PING 192.168.0.2 (192.168.0.2) 56(84) bytes of data. 64 bytes from
192.168.0.2: icmp_seq=1 ttl=128 time=0.292 ms 64 bytes from
192.168.0.2: icmp_seq=2 ttl=128 time=0.284 ms 64 bytes from
192.168.0.2: icmp_seq=3 ttl=128 time=0.281 ms 64 bytes from
192.168.0.2: icmp_seq=4 ttl=128 time=0.276 ms --- 192.168.0.2 ping
statistics --- 4 packets transmitted, 4 received, 0% packet loss, time
3005ms rtt min/avg/max/mdev = 0.276/0.283/0.292/0.013 ms

But when I look at the source of the page I have the following:

PING 192.168.0.2 (192.168.0.2) 56(84) bytes of data.
64 bytes from 192.168.0.2: icmp_seq=1 ttl=128 time=0.292 ms
64 bytes from 192.168.0.2: icmp_seq=2 ttl=128 time=0.284 ms
64 bytes from 192.168.0.2: icmp_seq=3 ttl=128 time=0.281 ms
64 bytes from 192.168.0.2: icmp_seq=4 ttl=128 time=0.276 ms

--- 192.168.0.2 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3005ms
rtt min/avg/max/mdev = 0.276/0.283/0.292/0.013 ms

I have tried using nl2br and that did not do a thing. How am I to
output the results from the ping command and have them display on the
webpage as they do in the source for the webpage? Thanks for your
help!

-Regan

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация