1

I am developing e-commerce platform to build their own site. In that, when customer logs in he will fill a form with his store name. When he submits he will get his space in the domain like this. storename.domain.com

I am not getting how to achieve this. please suggest

i have got this code but don't know how to modify it to take the subdomain name from the form control

function subd($host,$port,$ownername,$passw,$request) {

  //$sock = fsockopen('localhost',2082);
  $sock = fsockopen("www.mydomain.com", 80, $errno, $errstr, 30);
  echo $sock;

  if(!$sock) {
    print('Socket error');
    exit();
  }

  $authstr = "$ownername:$passw";
  $pass = base64_encode($authstr); 

  $in = "GET $request\r\n";
  $in .= "HTTP/1.0\r\n";
  $in .= "Host:$host\r\n";
  $in .= "Authorization: Basic $pass\r\n";
  $in .= "\r\n";

  fputs($sock, $in);

  while (!feof($sock)) {
    $result .= fgets ($sock,128);
  }

  fclose( $sock );
  return $result;
}
$domain='mydomain.com';

$subd="f1f1f1f1";

$request = "/frontend/$cpanel_skin/subdomain/doadddomain.html?rootdomain=$domain&domain=$subd";
hakre
  • 193,403
  • 52
  • 435
  • 836
user1321271
  • 255
  • 3
  • 10
  • 21
  • 2
    similar questions http://stackoverflow.com/questions/586129/create-subdomains-on-the-fly-with-htaccess-php and http://stackoverflow.com/questions/183928/how-to-let-php-to-create-subdomain-automatically-for-each-user – Sanjay Jun 07 '12 at 06:52
  • If your question is related on how to do automation with cpanel please make that visible. Also this website is more about programming questions than to support third-party-code. But feel free to make your question more clear. What is your question? – hakre Jun 07 '12 at 11:29
  • actually i am developing an ecommerce platform. when a customer buys a plan, he will ger his own store. for that i need to create a subdomain for each user when he buys it. then he can manage his store over there. So please tell me if any simple way to do this. that subdomain should be storename.domain.com – user1321271 Jun 07 '12 at 18:59
  • Check https://stackoverflow.com/questions/586129/create-subdomains-on-the-fly-with-htaccess-php – Karthikeyan Ganesan Jun 02 '17 at 11:38

0 Answers0