how i can Extracting the domain

Discussion in 'Programming/Scripts' started by qwe010, Oct 4, 2008.

  1. qwe010

    qwe010 New Member

    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


    PHP:
    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($orta0$uzunluk-1);
    } else {
    $ss $orta;
    }
    But not work Correctly

    Especially with the short domain

    any idea ?
     
  2. falko

    falko Super Moderator Howtoforge Staff

    What exactly are you trying to do?
     
  3. qwe010

    qwe010 New Member

    i want to write script ( add sites )
    http
    ftp
    ip

    and count the sites with sub domain and without
     
  4. falko

    falko Super Moderator Howtoforge Staff

Share This Page