команда в CMD на php

Horror

Registered
Значи искам следната команда да се изпълнява многократно(да речем 10 пъти) на php:
ping -t -l 10000 IP (xxx.xxx.xx.xx)
как ще стане? (+1)
 
А ми ако сървара не е на Windows ?Би трябвало да не може да се изпълни ,тъй като няма така команда под уникс.
 
Index, недей говори такива неща, че се поддитскам. Ping-ването е заложено още в най-старите Юникс системи и е интегрирано в огромно количество софтуер. Ето ти един нормален unix/linux:
ping --help

Код:
ping -s [-d] [-l] [-L] [-n] [-r] [-R] [-v] [ -i interface_address ] [-I interval] [-t ttl] host [packetsize] [count]
-d 	Set the SO_DEBUG socket option.
-l 	Loose source route. Use this option in the IP header to send the packet to the given host and back again. Usually specified with the -R option.
-L 	Turn off loopback of multicast packets. Normally, if there are members in the host group on the out- going interface, a copy of the multicast packets will be delivered to the local machine.
-n 	Show network addresses as numbers. ping normally displays addresses as host names.
-r 	Bypass the normal routing tables and send directly to a host on an attached network. If the host is not on a directly-attached network, an error is returned. This option can be used to ping a local host through an interface that has been dropped by the router daemon.
-R 	Record route. Sets the IP record route option, which will store the route of the packet inside the IP header. The contents of the record route will only be printed if the -v option is given, and only be set on return packets if the target host preserves the record route option across echos, or the -l option is given.
-v 	Verbose output. List any ICMP packets, other than ECHO_RESPONSE, that are received.
-i interface_address 	Specify the outgoing interface address to use for multicast packets. The default interface address for multicast packets is determined from the (unicast) routing tables.
-I interval 	Specify the interval between successive transmissions. The default is one second.
-t ttl 	Specify the IP time to live for unicast and multicast packets. The default time to live for unicast packets is set with ndd (using the icmp_def_ttl variable). The default time to live for multicast is one hop.
host 	The network host.
packetsize 	Specified size of packetsize. Default is 64.
count 	Amount of times to send the ping request.

Разбира се горния код може да прави проверкак каква е операционната система и според това да пуска съответният ping. И тъй като има и unix ping, а също и GNU ping е добре да се провери конкретния мануал на системата от която ще се пусне ping-a. А ето и примерен код за системата:
Код:
if (strstr(PHP_OS, "WIN")) {
$os="Windows";
}
else{
$os="Unixlike";
}
По отношение на стартирането на системни команди аз използвам често и ляво-наклонените еденични кавики:
echo `ping xx.xx.xx.xx`;
 
PhrozenCrew- никой не е безгрешен,човек се учи докато е жив.
Извинявам се поста ми по-горе.
 
Това за ученето абсолютно го споделям. Ам за извинението не. Като пием по 1-2 ракии с една каруца шопска салата може и да ти го приема :))
 

Back
Горе