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.
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.
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.