CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
How to output ping to webpage ?


New User

Dec 23, 2009, 12:57 AM

Post #1 of 2 (2277 views)
How to output ping to webpage ? Can't Post

My code:

print "Content-type: text/html\n\n";
open FH, "ping -c 5|" or die "Failed to open pipeline";
while(<FH>) {
$string .= $_."<br>";
print $string

When I run it from the command line interface. It success output:

Content-type: text/html

PING ( 56(84) bytes of data.
<br>64 bytes from ( icmp_seq=1 ttl=64 time=0.111 ms
<br>64 bytes from ( icmp_seq=2 ttl=64 time=0.051 ms
<br>64 bytes from ( icmp_seq=3 ttl=64 time=0.062 ms
<br>64 bytes from ( icmp_seq=4 ttl=64 time=0.052 ms
<br>64 bytes from ( icmp_seq=5 ttl=64 time=0.042 ms
<br>--- ping statistics ---
<br>5 packets transmitted, 5 received, 0% packet loss, time 3996ms
<br>rtt min/avg/max/mdev = 0.042/0.063/0.111/0.026 ms

But I run it from the web server with perl support, it cannot output anything.
I have tried 3 web server from different ISP. Anybody help me ?

Veteran / Moderator

Dec 23, 2009, 6:01 AM

Post #2 of 2 (2273 views)
Re: [200120022003] How to output ping to webpage ? [In reply to] Can't Post

Are you receiving an error page or a blank page?

Did you check the web sever error log?


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives