myspiel
07-22-2009, 08:17 PM
Hello,
I am new to webpages and scripting so this might be a simple problem to the more experienced.
What I am attempting to do is send a UDP message from a webpage to a external server app (outside webserver).
(Running Web server on linux system.)
To test this out I created a small webpage (one button) and when the button is clicked it calls a perl script that sends a test message. My problem is that I don't want the perl script to start a new webpage, I just need it to send the message in the background.
here is the webpage code:
<html>
<head><title>Button Test</title></head>
<body>
<form>
<input type="button" name="custom_button_01" value="Rover 1" onclick="document.location.href= 'http://daystar/cgi-bin/second.pl';"/>
</form>
</body>
</html>
Here is the perl script:
#!/usr/bin/perl -w
use IO::Socket;
my $message = IO::Socket::INET->new(Proto=>"udp",PeerPort=>4000,PeerAddr=>"10.6.6.1");
$message->send("LABELSNOD24");
print "content-type: text/html\n\n";
print "Hello Perl";
if I leave out the last two lines so nothing is required to be displayed, I get an Internal Server Error
Premature end of script headers
Can anyone point me in the right direction.
I am new to webpages and scripting so this might be a simple problem to the more experienced.
What I am attempting to do is send a UDP message from a webpage to a external server app (outside webserver).
(Running Web server on linux system.)
To test this out I created a small webpage (one button) and when the button is clicked it calls a perl script that sends a test message. My problem is that I don't want the perl script to start a new webpage, I just need it to send the message in the background.
here is the webpage code:
<html>
<head><title>Button Test</title></head>
<body>
<form>
<input type="button" name="custom_button_01" value="Rover 1" onclick="document.location.href= 'http://daystar/cgi-bin/second.pl';"/>
</form>
</body>
</html>
Here is the perl script:
#!/usr/bin/perl -w
use IO::Socket;
my $message = IO::Socket::INET->new(Proto=>"udp",PeerPort=>4000,PeerAddr=>"10.6.6.1");
$message->send("LABELSNOD24");
print "content-type: text/html\n\n";
print "Hello Perl";
if I leave out the last two lines so nothing is required to be displayed, I get an Internal Server Error
Premature end of script headers
Can anyone point me in the right direction.