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


 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


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