Title: Create website plugin
Last modified: August 20, 2016

---

# Create website plugin

 *  [karan](https://wordpress.org/support/users/karankothari/)
 * (@karankothari)
 * [13 years ago](https://wordpress.org/support/topic/create-website-plugin/)
 * Hello friends.. Is there any plugin where we can ask our visitors to create free
   website for themselves as subdomain to our website..
    one of many sample website
   is: [http://myshaadi.in/main/pages/display](http://myshaadi.in/main/pages/display)
   Eagerly waiting for someone’s help.

Viewing 1 replies (of 1 total)

 *  [DS](https://wordpress.org/support/users/deepak-selvan/)
 * (@deepak-selvan)
 * [13 years ago](https://wordpress.org/support/topic/create-website-plugin/#post-3614979)
 * There is no plugin but this code should help you create a new sub-domain.
 * _[ Moderator Note: [Please post code](http://codex.wordpress.org/Forum_Welcome#Posting_Code)
   or markup snippets between backticks or use the code button. ]_
 *     ```
       function create_subdomain($subDomain,$cPanelUser,$cPanelPass,$rootDomain) {
   
       //  $buildRequest = "/frontend/x3/subdomain/doadddomain.html?rootdomain=" . $rootDomain . "&domain=" . $subDomain;
   
           $buildRequest = "/frontend/x3/subdomain/doadddomain.html?rootdomain=" . $rootDomain . "&domain=" . $subDomain . "&dir=public_html/subdomains/" . $subDomain;
   
           $openSocket = fsockopen('localhost',2082);
           if(!$openSocket) {
               return "Socket error";
               exit();
           }
   
           $authString = $cPanelUser . ":" . $cPanelPass;
           $authPass = base64_encode($authString);
           $buildHeaders  = "GET " . $buildRequest ."\r\n";
           $buildHeaders .= "HTTP/1.0\r\n";
           $buildHeaders .= "Host:localhost\r\n";
           $buildHeaders .= "Authorization: Basic " . $authPass . "\r\n";
           $buildHeaders .= "\r\n";
   
           fputs($openSocket, $buildHeaders);
           while(!feof($openSocket)) {
           fgets($openSocket,128);
           }
           fclose($openSocket);
   
           $newDomain = "http://" . $subDomain . "." . $rootDomain . "/";
   
       //  return "Created subdomain $newDomain";
   
       }
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Create website plugin’ is closed to new replies.

## Tags

 * [subdomain](https://wordpress.org/support/topic-tag/subdomain/)

 * 1 reply
 * 2 participants
 * Last reply from: [DS](https://wordpress.org/support/users/deepak-selvan/)
 * Last activity: [13 years ago](https://wordpress.org/support/topic/create-website-plugin/#post-3614979)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
