let's say I collect the input from $_POST["domain"] to $domain:
$domain = $_POST["domain"];
And the content of $domain is cat /etc/passwd; sub.domain.com.
How can I get only sub.domain.com without any malicious directives?
And $_POST["domain"] could also be a IPv4 or IPv6 address.