Jump to content

Subdomain creation using php


robert_gsfame

Recommended Posts

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 :P??

 

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 );

?>

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/182493-subdomain-creation-using-php/
Share on other sites

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/

 

 

 

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.