Esempio n. 1
0
Fetcher::$spanHosts = isset($opts['span-hosts']) || isset($opts['H']);
Fetcher::$quiet = isset($opts['quiet']) || isset($opts['q']);
Fetcher::$recursive = isset($opts['recursive']) || isset($opts['r']);
Fetcher::$verbose = isset($opts['verbose']) || isset($opts['v']);
if (isset($opts['connect-timeout'])) {
    Fetcher::$connectTimeout = $opts['connect-timeout'];
}
if (isset($opts['max-redirect'])) {
    Fetcher::$maxRedirect = $opts['max-redirect'];
}
if (isset($opts['level']) || isset($opts['l'])) {
    Fetcher::$maxDepth = isset($opts['level']) ? $opts['level'] : $opts['l'];
}
if (isset($opts['output-directory']) || isset($opts['o'])) {
    Fetcher::$outputDirectory = isset($opts['output-directory']) ? $opts['output-directory'] : $opts['o'];
}
if (isset($opts['timeout']) || isset($opts['T'])) {
    Fetcher::$timeout = isset($opts['timeout']) ? $opts['timeout'] : $opts['T'];
}
if (isset($opts['wait']) || isset($opts['w'])) {
    Fetcher::$wait = isset($opts['wait']) ? $opts['wait'] : $opts['w'];
}
try {
    Fetcher::fetch($url);
} catch (Exception $e) {
    if (!Fetcher::$quiet) {
        fwrite(STDERR, '[error] ' . $e->getMessage() . "\n");
    }
    exit(1);
}
exit(0);