Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 22-05-2009
Member
 
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?
Reply With Quote
  #2  
Old 22-05-2009
Member
 
Join Date: May 2008
Posts: 2,293
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.
Reply With Quote
  #3  
Old 22-05-2009
Member
 
Join Date: Apr 2008
Posts: 2,001
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
Reply With Quote
  #4  
Old 22-05-2009
Member
 
Join Date: Feb 2008
Posts: 1,848
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...
Reply With Quote
  #5  
Old 22-05-2009
Member
 
Join Date: May 2008
Posts: 2,008
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.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Get domain name and domain statistics using PHP"
Thread Thread Starter Forum Replies Last Post
An active directory Domain Controller for the domain could not becontacted in windows vista Business CheyeNnne Active Directory 7 28-12-2010 10:05 PM
Unable to see a forest trusted domain from XP admin tools but able to see from a Domain Controller Assasin boy Networking & Security 5 24-08-2010 03:12 AM
I have got two domain, I can't ping FQDN, Domain name but not the hostname of the other domain kaikoa Networking & Security 1 16-09-2009 10:11 AM
Migrate users from Existing Windows 2003 Domain to new 2008 Domain Lupin Active Directory 3 09-07-2009 05:57 PM
Child domain user does not show parent domain group membership Pratim Active Directory 1 19-06-2008 01:58 AM


All times are GMT +5.5. The time now is 09:56 PM.