qwe010
4th October 2008, 04:28
hello
how i can Extracting the domain
from link like that
http://www.phpbuilder.com/board/
and
http://sub.phpbuilder.com/board/
i try with strstr
if ( strstr($site, "www") ){
$ilk = strpos($site, ".");
$orta = substr($site, $ilk+1);
$ilkson = strpos($orta, "/");
$orta = substr($site, $ilk+1, $ilkson+1);
$uzunluk = strlen($orta);
$son = substr($orta, $uzunluk-1);
if ($son == "/"){
$ss = substr($orta, 0, $uzunluk-1);
} else {
$ss = $orta;
}
But not work Correctly
Especially with the short domain
any idea ?
how i can Extracting the domain
from link like that
http://www.phpbuilder.com/board/
and
http://sub.phpbuilder.com/board/
i try with strstr
if ( strstr($site, "www") ){
$ilk = strpos($site, ".");
$orta = substr($site, $ilk+1);
$ilkson = strpos($orta, "/");
$orta = substr($site, $ilk+1, $ilkson+1);
$uzunluk = strlen($orta);
$son = substr($orta, $uzunluk-1);
if ($son == "/"){
$ss = substr($orta, 0, $uzunluk-1);
} else {
$ss = $orta;
}
But not work Correctly
Especially with the short domain
any idea ?