Results 1 to 5 of 5

Thread: Get domain name and domain statistics using PHP

  1. #1
    Join Date
    Oct 2008
    Posts
    31

    Get domain name and domain statistics using PHP

    I came to know that through PHP we can determine the current domain name.
    Also, I think it is possible to get the domain statistics with the help of PHP.
    Can anybody, who might have worked on this, tell me how to do this?

  2. #2
    Join Date
    May 2008
    Posts
    2,297

    Re: Get domain name and domain statistics using PHP

    You need to install this PHP script.
    PHP Code:
    <?php
    function whois ($query$server “whois.internic.net”) {
    $handle fsockopen ($server43);
    fwrite ($handle,$query);
    while (!
    feof ($handle)) {
    $results .= fread ($handle102400);
    }
    if (
    $server == ‘whois.internic.net’) {
    preg_match (#Whois Server: (.*)#’, $results, $matches);
    $results whois ($query$matches[1]);
    }
    return 
    $results;
    }
    echo 
    whois ($_REQUEST['domain']);
    ?>
    Copy this code and paste it in a file called whois.php in your root directory

    Now, open the web browser type http://www.yourdomain.com/whois.php?....anydomain.com

    Now you can check who is of any domain from your site.

  3. #3
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Get domain name and domain statistics using PHP

    If you want to know how to get the current domain name from your website in php you can do it with the code given below:
    Code:
    echo $_SERVER['HTTP_HOST']
    this will display the domain name and the hostname like this: www.techarena.in

  4. #4
    Join Date
    Feb 2008
    Posts
    1,852

    Re: Get domain name and domain statistics using PHP

    Instead of using ready limited ready functions, create yours with playing around with strings..., in PHP you can use stripos function to find a position of a string, use it as parameter in substr and find whatever between "//" and "/"... and so on...

  5. #5
    Join Date
    May 2008
    Posts
    2,012

    Re: Get domain name and domain statistics using PHP

    Use this PHP code,
    PHP Code:
    $domain $_SERVER['HTTP_HOST']; 
    HTTP_HOST returns the root domain as it is displayed in the address bar.

Similar Threads

  1. Replies: 7
    Last Post: 28-12-2010, 10:05 PM
  2. Replies: 5
    Last Post: 24-08-2010, 03:12 AM
  3. Replies: 1
    Last Post: 16-09-2009, 10:11 AM
  4. Replies: 3
    Last Post: 09-07-2009, 05:57 PM
  5. Replies: 1
    Last Post: 19-06-2008, 01:58 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,750,363,126.00866 seconds with 16 queries