09-19-2001
About ping command
Hi!
I have small problem. I want to ping a server and the result shouldn't be printed in the browser window, just become a value.
Here you can see the script that I have:
$command="ping linux.com -t ttl -c1 | tail -1 | awk '{print $4 \" \" $5}'";
$output = system($command);
system("exit(0)");
echo "DATA: $output";
?>
When I run this in my browser the resualt will be as follow:
33.1/33.1/33.1 ms DATA: 33.1/33.1/33.1 ms
The echo value is just a test for me to see if the $output value is OK.
What I want is that the value before DATA: 33.1/33.1/33.1 ms
shouldn't be viewed in the browser just DATA: 33.1/33.1/33.1 ms
Could someone please help me with this problem?
Best Regards
Peter Håkansson
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi!
I have small problem. I want to ping a server and the result shouldn't be printed in the browser window, just become a value.
Here you can see the script that I have:
<?
$command="ping linux.com -t ttl -c1 | tail -1 | awk '{print $4 \" \" $5}'";
$output = system($command);... (1 Reply)
Discussion started by: Papa Deoo
1 Replies
2. IP Networking
Do anyone telle me please how to use PING command to verify connection (TCP/IP) between serveurs.
thanks (1 Reply)
Discussion started by: hoang
1 Replies
3. Shell Programming and Scripting
What does '-c' mean in ping command? Is this option specific to bash shell?
Deepa (3 Replies)
Discussion started by: Deepa
3 Replies
4. UNIX for Dummies Questions & Answers
HI,
I am new to unix. I have used some basic commands and written some simple shell scripts in teh past. Currently, I am supposed to write a script to continuosly check if a couple of machines are up and if not to start a script. I am using a bash - 2.03. I have tryying to use the ping command... (3 Replies)
Discussion started by: swepaul
3 Replies
5. UNIX for Dummies Questions & Answers
Hello Everybody:
Im the root of the system, I need to grant some limited priviliges user an acess to the ping command so he can ping some IPs with his script.
should I add the command to his path??
or what??
Thanks a lot (3 Replies)
Discussion started by: aladdin
3 Replies
6. UNIX for Advanced & Expert Users
for i in $var; do
for j in $var; do
if
then
ssh -x -a "$host_login_name"@${i} ping -c 3 -s 3 ${j}
if
then
printf "Success\n"
else
printf "Failed\n"
fi
fi
done
done
Enter your box login... (2 Replies)
Discussion started by: happyrain
2 Replies
7. UNIX for Dummies Questions & Answers
i cannot find a usefull ping and traceroute command from TCP to another TCP server with port.
I usually do only traceroute IP and ping IP..is that enough? I wanted to check its connectivity to an IP address with port..
example:
from ip 1.1.1.1 (TCP port 1234)
destination 2.2.2.2 (TCP... (1 Reply)
Discussion started by: lhareigh890
1 Replies
8. AIX
Hi All,
I'm testing ping command on two servers.
A,B,C,D are servers
From A-->B:
ping -c 3 -p ff -s30720 <B IP-Addres>
This works fine.
From C-->D:
ping -c 3 -p ff -s30720 <D IP-Addres>
This is NOT working and 100% packe loss :(
But if I use 8700 instead of 30720 for packet size... (6 Replies)
Discussion started by: saraperu
6 Replies
9. UNIX for Dummies Questions & Answers
Hi,
I have a list of 500 IP address and need to ping all the IP address. I had written a script to do this and its working if the IP is valid one. If any invalid IP present, the process got hang up.
Also I have tried with -c , -I and -w options, its not working.
Any one help me on this... (2 Replies)
Discussion started by: Rksiva
2 Replies
10. Shell Programming and Scripting
Hi,
I have a shell script, that has to run in putty for days together. So , I need to keep the network server connection alive and running. The execution of shell script shouldn't be interrupted as it produces undesirable results.
Can anyone provide me with a script ? (3 Replies)
Discussion started by: angie1234
3 Replies
LEARN ABOUT PHP
mysqli_set_local_infile_handler
MYSQLI_SET_LOCAL_INFILE_HANDLER(3) 1 MYSQLI_SET_LOCAL_INFILE_HANDLER(3)
mysqli::set_local_infile_handler - Set callback function for LOAD DATA LOCAL INFILE command
Object oriented style
SYNOPSIS
bool mysqli::set_local_infile_handler (mysqli $link, callable $read_func)
DESCRIPTION
Procedural style
bool mysqli_set_local_infile_handler (mysqli $link, callable $read_func)
Set callback function for LOAD DATA LOCAL INFILE command
The callbacks task is to read input from the file specified in the LOAD DATA LOCAL INFILE and to reformat it into the format understood by
LOAD DATA INFILE.
The returned data needs to match the format specified in the LOAD DATA
PARAMETERS
o $
link -Procedural style only: A link identifier returned by mysqli_connect(3) or mysqli_init(3)
o $read_func
- A callback function or object method taking the following parameters:
o $stream
-A PHP stream associated with the SQL commands INFILE
o $&buffer
-A string buffer to store the rewritten input into
o $buflen
-The maximum number of characters to be stored in the buffer
o $&errormsg
-If an error occurs you can store an error message in here
The callback function should return the number of characters stored in the $buffer or a negative value if an error occurred.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
EXAMPLES
Example #1
mysqli::set_local_infile_handler example
Object oriented style
<?php
$db = mysqli_init();
$db->real_connect("localhost","root","","test");
function callme($stream, &$buffer, $buflen, &$errmsg)
{
$buffer = fgets($stream);
echo $buffer;
// convert to upper case and replace "," delimiter with [TAB]
$buffer = strtoupper(str_replace(",", " ", $buffer));
return strlen($buffer);
}
echo "Input:
";
$db->set_local_infile_handler("callme");
$db->query("LOAD DATA LOCAL INFILE 'input.txt' INTO TABLE t1");
$db->set_local_infile_default();
$res = $db->query("SELECT * FROM t1");
echo "
Result:
";
while ($row = $res->fetch_assoc()) {
echo join(",", $row)."
";
}
?>
Procedural style
<?php
$db = mysqli_init();
mysqli_real_connect($db, "localhost","root","","test");
function callme($stream, &$buffer, $buflen, &$errmsg)
{
$buffer = fgets($stream);
echo $buffer;
// convert to upper case and replace "," delimiter with [TAB]
$buffer = strtoupper(str_replace(",", " ", $buffer));
return strlen($buffer);
}
echo "Input:
";
mysqli_set_local_infile_handler($db, "callme");
mysqli_query($db, "LOAD DATA LOCAL INFILE 'input.txt' INTO TABLE t1");
mysqli_set_local_infile_default($db);
$res = mysqli_query($db, "SELECT * FROM t1");
echo "
Result:
";
while ($row = mysqli_fetch_assoc($res)) {
echo join(",", $row)."
";
}
?>
The above examples will output:
Input:
23,foo
42,bar
Output:
23,FOO
42,BAR
SEE ALSO
mysqli_set_local_infile_default(3).
PHP Documentation Group MYSQLI_SET_LOCAL_INFILE_HANDLER(3)