12345678910111213141516171819202122232425 |
- <?php
- define('CONFIG_FILE', __DIR__ . '/config.php');
- include __DIR__ . '/functions.php';
- //检查参数
- if ($argc < 2) {
- die("Usage: {$argv[0]} CMD ARG...\n");
- }
- //加载配置
- $cfg = [];
- load_config();
- $s = stream_socket_client("udp://{$cfg['udp_host']}:{$cfg['udp_port']}", $errno, $error);
- if (!$s) {
- die("stream_socket_server() call failed: #{$errno},{$error}");
- }
- $args = $argv;
- array_shift($args); //php_self
- $flag = fwrite($s, json_encode($args));
- fclose($s);
- var_dump($flag);
|