We have uploaded our cms to a dedicated server. we have two options for our users (user your own domain, use subdomain). when a user register him/her self and select subdomain and want to access his/her website so he cant access it with his/her subdomain name integrated with our domain like (car.websaz.af) instead he can access it with the template name (choosed for his/her website) integrated with our domain name like (temp7.websaz.af). I have created a php file and used gethostbyname() to resolve the hostname to ip but not working. cod used in the file is as below: Subdomain 'tmp12.websaz.af' resolves to <?php echo gethostbyname('tmp12.websaz.af'); ?>
The file containing function gethostbyname is inside public_html and the folders for sub domains are inside websaz_server/HOST/website so I have changed the function as you advised: <?php echo gethostbyname('tmp12.websaz.af/websaz_server/HOST/website/w12'); ?> but still no luck for ip of that subdomain and it gives me tmp12.websaz.af/websaz_server/HOST/website/w12
Even if I write <?php echo gethostbyname('google.com'); ?> get google.com not showing its ip address.
Does it need any setting in the server?
I have put this file to test subdomain resolvation because in our cms when a user creates a website and saves it, when he clicks on his website in the dashboard to manage it, it opens in the browser with this URL tmp12.websaz.af not showing like property.websaz.af but if he type property.websaz.af in the browser then it comes.
Instead of gethostbyname() function
Try used gethostbyaddr() function.
You need to put property.websaz.af in a folder called property
When you type tmp12.websaz.af/property then it will open.
Yes a subdomain has the same ip as the main domain. We have a CMS that users can create a website inside but when they go to their dashboard/My websites section and click on their website to change or add something to their website then their website opens in browser with a tmp+website id.maindomain.af like tmp12.websaz.af not like property.websaz.af but if they type property.websaz.af in the browser then it comes. Someone said there is problem with gethostbyname() function that not working properly.
If you know that some settings should be applied on the server then could you please write the instructions?
I hope you know that you can't really get visitors actual real Ip address.
As far as I know there's no script that can do that.
You just want to find someone ip address? Right?
You don't need to used this gethostbyname() function anymore.
Read and try the code from this article (the code is a link):
Just want to check hostname to ip address resolvation. Because when a user get registered in out cms and creates website then go to his dashboard and click on his website to manage it, it opens with a temporary url not the actual url like (property.websaz.af), it open with tmp12.websaz.af(this is a subdomain). Subdomains are integrated with our main domain ip address which is not a new ip address and a visitor's ip address. Someone advised that gethostbyname function is not working properly to resolve subdomains to your ip address.
Someone advised that gethostbyname function is not working properly to resolve subdomains to your ip address.
If that person advised you to use this function then did this person told you it should look like this:
If you still have issue please post your code. Right now I feel everyone is guessing including me.