/* Pluck the protocol, hostname, and port number from a URL */ if (preg_match('{^(https?):// ([^/:]+) (?::(\d+))? }x', $url, $matches)) { $proto = $matches[1]; $host = $matches[2]; $port = $matches[3] ? $matches[3] : ($proto == "http" ? 80 : 443); print "Protocol: $proto\n"; print "Host : $host\n"; print "Port : $port\n"; } ----------------------------------------------------------------------------- Copyright 1997-2024 Jeffrey Friedl