robert_gsfame Posted November 22, 2009 Share Posted November 22, 2009 I have this code for creating subdomain for my user, i found it through googling...can anyone tell me whether this code correct or not, and can i test creating subdomain on my localhost ?? Thx a lot <? $mydomain = "mydomain.com"; $username = "domainusername"; $password = "domainpassword"; $cpanel_theme = "x"; $subdomain = "test"; $socket = fsockopen($mydomain ,2082); $authstr = "$username:$ password" ; $pass = base64_encode($authstr) ; $target = "/frontend/$ cpanel_theme/ subdomain/ doadddomain. html?domain= $subdomain &rootdomain= $mydomain" ; $in = "GET $target HTTP/1.0 Authorization: Basic $pass"; fputs($socket, $in); fclose( $socket ); ?> Quote Link to comment https://forums.phpfreaks.com/topic/182493-subdomain-creation-using-php/ Share on other sites More sharing options...
wildteen88 Posted November 22, 2009 Share Posted November 22, 2009 You don't use PHP to setup domains. This is handled by your HTTP Server's configuration, for example with Apache you can setup what is know as virtual hosts for hosting multiple (sub)domains. Quote Link to comment https://forums.phpfreaks.com/topic/182493-subdomain-creation-using-php/#findComment-963182 Share on other sites More sharing options...
robert_gsfame Posted November 22, 2009 Author Share Posted November 22, 2009 so how can i do it if i want to create a subdomain for my user once registered for example: James once registered with my site, and they automatically get their own page which can be accessed through this link http://James.mydomain.com/ Quote Link to comment https://forums.phpfreaks.com/topic/182493-subdomain-creation-using-php/#findComment-963184 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.