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?
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?
You need to install this PHP script.
Copy this code and paste it in a file called whois.php in your root directoryPHP Code:
<?php
function whois ($query, $server = “whois.internic.net”) {
$handle = fsockopen ($server, 43);
fwrite ($handle,$query);
while (!feof ($handle)) {
$results .= fread ($handle, 102400);
}
if ($server == ‘whois.internic.net’) {
preg_match (’#Whois Server: (.*)#’, $results, $matches);
$results = whois ($query, $matches[1]);
}
return $results;
}
echo whois ($_REQUEST['domain']);
?>
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.
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:
this will display the domain name and the hostname like this: www.techarena.inCode:echo $_SERVER['HTTP_HOST']
![]()
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...
Use this PHP code,
HTTP_HOST returns the root domain as it is displayed in the address bar.PHP Code:
$domain = $_SERVER['HTTP_HOST'];
Bookmarks