How to create Subdomain using PHP

in one of the project i did how to create subdomain dynamically using php script. on that requirement was like if any customer has signup with paid service than i have to assign them one subdomain automatically if paid done that time i did below code for create main domain’s sub domain dynamically. and on that time we can’t tell to client that pls create subdomain from cpanel manually that’s why i was try to create php script so client no need to do anything manually and my client on that time so much happy. so lets i explain you how to do this things using php

index.php

 How To call

$ur_subdomain_name = your sub domain name for e.g myblog

$ur_cpanel_username  = your cpanel username

$ur_cpanel_password   =your cpanel password

$ur_main_domain         = your main domain name for e.g www.smitcky.com

smitcky_newsubdomain($ur_subdomain_name,$ur_cpanel_username,$ur_cpanel_password,$ur_main_domain)

after creating and running this script it will creating sub domain automatically using php script and in next post i will explain you how to delete sub domain using php script.

Thanks :)