12345678910111213141516171819202122232425262728 |
- #! php.exe -q
- <?php
- include_once __DIR__ . '/SendData.php';
- /* *
- * PHP CLI code, to send cmem key with gzcompress and base64
- * gzcompress can smaller the string 10 times or more, base64 can make sure that
- * the data can be saved and transfered safely by http.
- * author: gwang (mail@wanggangzero.cn)
- * version: 1.0
- */
- // end class
- // do the work
- if (strtolower(php_sapi_name()) == "cli") { # 命令行模式下才执行这段逻辑
- if ($argv[1] == "-h" || $argc < 3) {
- exit("Usage: \n " . $argv[0] . " url zoneid filename \n ");
- } else {
- $url = $argv[1];
- $zoneid = $argv[2];
- $filename = $argv[3];
- $data = file_get_contents($filename);
- $key = basename($filename, ".txt");
- $value = $data;
- SendData::Send($zoneid, $url, $key, $value);
- }
- } else {
- exit("This program was designed for cli!");
- }
|