View Full Version : help with code
is0lized
March 25th, 2002, 12:10
i want to get some php to ping a server then if it gets a response it prints Online, and if it doesnt get a response it prints offline, and i need to be able to include it some how on one of my pages
niv
March 25th, 2002, 15:12
Screw PHP. :devious2:
This'll only work if ping is installed...which I hope it is. :rolleyes:
#!/usr/bin/perl
use CGI qw/:param/;
$command="ping ";
if (param("times")) { $command .= " -c " . param("times") . " " } else {
$command .= " -c3 " }
if (param("packetsize")){
$command .= " -s " . param("packetsize") . " "}
open (PING, $command . param("server"));
$content = join ("", <PING>);
close (PING);
print << TXT;
Content-type: text/plain
$content
TXT
call script using the following variables:
mandatory:
server: hostmask or IP address of remote host
optional:
packetsize: size of packet in bytes (numeric, duh)
times: number of times to ping, 3 by default
[add]
argh, stupid mistakes :biggrin2:
invalid
March 25th, 2002, 17:13
http://www.hotscripts.com/Detailed/9326.html
<- that should work
is0lized
March 25th, 2002, 22:49
Originally posted by Hayama-kun
Screw PHP
---- cgi :mad:
ducktape
March 25th, 2002, 23:29
Originally posted by is0lized
---- cgi :mad:
I second that motion
bigperm
March 25th, 2002, 23:46
PHP is CGI.
You meant to say "Fvck Perl".
niv
March 26th, 2002, 20:09
Originally posted by is0lized
---- cgi :mad:
Wha? You no like php? :D
#!/usr/bin/php
echo "This is your precious PHP in CGI form. :eek::biggrin2:";
invalid
March 26th, 2002, 20:15
most people think cgi is perl since thier always put together... i like php more for web aplications but perl is much better for sysadmins on *nix servers doing text processing, etc.
niv
March 26th, 2002, 20:17
That's not necessarily true. That was back in the 80s, where Perl, like C, was a data processing language. [Perl standing for Pratical Extraction and Report Language] Perl, now like C, can handle graphical programs (my friend has been working on these using X).
PHP as well, following the lead of Perl, developed its PHP-GTK, now widely used as well.
Perl is actually remarkably easier to learn than PHP...we don't have to memorize 5 million function names--we'll just create our own. That and modules are easily obtained and are easily installed. www.cpan.org :biggrin2:
cheatpark
March 26th, 2002, 21:02
Originally posted by Hayama-kun
we'll just create our own.
You can do that in php too but obviously you have to still program them. But then you still have to program them too in perl. I also believe php to be faster. Its a matter of opinion and nobody will change their minds so lets just leave it at this.
megapuzik
March 27th, 2002, 08:30
You can use the openGL with php.....(search in sourceforge)
Dusty
March 27th, 2002, 11:18
I love sweeping generalizations!
PHP is faster! Faster doing what? Just faster!
PHP is easier! Easier in what way? Just easier!
PHP is more suited to the web! How is it more suited? Just is!
I'll agree with you, TPFKaN. It irks me as well when people think of CGI and Perl as being synonymous and polar opposite to PHP.
invalid
March 27th, 2002, 17:34
Perl is actually remarkably easier to learn than PHP...we don't have to memorize 5 million function names--we'll just create our own. That and modules are easily obtained and are easily installed. www.cpan.org
well, i dont know about you guys but i'd much rather memorize 5 million functions then write my own over and over again. If your having trouble remembering functions goto php.net or buy a function reference book like i did.
Powered by vBulletin® Version 4.1.7 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.