This seems like an excellent job for Java, given a recent post here with the title Java is the machine that goes "Ping!".

Sorry, absolutely off topic and not helpful at all, but I really couldn't resist ;-)

Given that you need an entry in the syslog, you'll have little choice but server side logic, I'd think. That means writing a simple CGI script. Here's a quick and dirty hack that shows the basic things to do. Cleaning it up is left as an exercise to the reader. Obviously the first thing to change is the $ping_cmd which is right for my Windows box but probably wrong for your machine.

No syslog entry though since you don't specify what OS this is supposed to run under. Have a look at CGI::Carp error redirection for a possible approach.

The HTML code to call it for a specific IP address would look like

<a href="http://www.you.com/cgi-bin/ping.pl?ip=131.133.33.18">131.133. +33.18</a>

Hope this helps, -gjb-

Update: As IlyaM points out, there are a number of security holes in this code. I'm not a web programmer (well, not since CGI.pm was invented), so I'd better refrain from answering web related questions. The first problem he mentions is very bad, I wouldn't have done that when I wrote CGI scripts years ago. I'll leave the code as is for educational purposes, but don't use it without heeding IlyaM's advice in the reply below.

#!perl use strict; use warnings; use CGI qw( :standard ); use CGI::Carp qw( fatalsToBrowser ); my $ping_cmd = 'c:/WINNT/system32/ping'; my $query = CGI->new(); my $param = $query->Vars(); print header(); print start_html("Ping page"); if (exists $param->{ip}) { my $result = `$ping_cmd $param->{ip}`; print p("You try to ping $param->{ip}, the result is:", br(), pre($result)); } else { print p("No ip address specified in query"); } print end_html();

In reply to Re: Ping from HTML by gjb
in thread Ping from HTML by fouttyw

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.