if (-t STDIN) { # command line. for params, substitute special chars (e.g. & => %26) # (there must be a module out there which does that for you) } else { # via webserver }