The following one is to determine whether the domain name entered is legal, and then the http,https,ftp for processing, analysis and send
function _scan_url ()
{
$req = $this->_url;
$pos = Strpos ($req, '://');
$this->_protocol = Strtolower (substr ($req, 0, $pos));
$req = substr ($req, $pos +3);
$pos = Strpos ($req, '/');
if ($pos = = False)
$pos = strlen ($req);
$host = substr ($req, 0, $pos);
if (Strpos ($host, ': ')!== false)
{
List ($this->_host, $this->_port) = Explode (': ', $host);
}
Else
{
$this->_host = $host;
$this->_port = ($this->_protocol = = ' https ')? 443:80;
}
$this->_uri = substr ($req, $pos);
if ($this->_uri = = ")
$this->_uri = '/';
}
Function Cleandomain ($q, $w =0) {//collating domain name $w = 1 filtering www. prefix $w =0 not filtered
$q = Htmlspecialchars (Strtolower (Trim ($q));
if (substr ($q, 0,7) = = "http://" | | substr ($Q, 0,8) = = "https://" | | substr ($Q, 0,6) = = "ftp://") {
$q = Str_replace ("http:/", "", $q);
$q = Str_replace ("https:/", "", $q);
$q = Str_replace ("ftp:/", "", $q);
}
if substr ($q, 0,4) = = "www." && $w ==1) {
$q = Str_replace ("www.", "", $q);
}< br> $q = Trim ($q, "/");
return $q;
}