Search
 
SCRIPT & CODE EXAMPLE
 

PHP

Creating dynamic subdomain in php

$whmusername = "cpanel_username";
$whmpassword = "cpanel_password";
$subdomain = 'newsubdomain';
$cpanel_ip = 'IP_ADDRESS'; //ip of cpanel or your_domain.com
$domain = "your_domain.com";

$query = "https://".$cpanel_ip."2083/json-api/cpanel?cpanel_jsonapi_module=SubDomain&cpanel_jsonapi_func=addsubdomain&cpanel_jsonapi_apiversion=2&dir=/public_html/".$subdomain.".".$domain."/&rootdomain=".$domain."&domain=".$subdomain."";

$curl = curl_init();
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER,0);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,0);
curl_setopt($curl, CURLOPT_HEADER,0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER,1);
$header[0] = "Authorization: Basic " . base64_encode($whmusername.":".$whmpassword) . "

";
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
curl_setopt($curl, CURLOPT_URL, $query);
$result = curl_exec($curl);
curl_close($curl);
Comment

PREVIOUS NEXT
Code Example
Php :: laravel get 
Php :: Laravel 7 pagination with search filter 
Php :: if user not signed in redirected to login laravel from route 
Php :: laravel link to css or image 
Php :: SIMPLE linked list in php 
Php :: laravel sanctum authentication 
Php :: magento check which user has added a product 
Php :: What was the old name of PHP? 
Php :: create middleware laravel 
Php :: comment installer laravel avec docker 
Php :: compare key and one array 
Php :: laravel where in query builder 
Php :: how to logout in phpmyadmin 
Php :: what is isset in php 
Php :: controller class does not exist laravel 
Php :: php remove directory only if empty 
Php :: php pre 
Php :: merge pdf php fpdf 
Php :: how to run php in javascript 
Php :: php get date from day of year 
Php :: -with() in laravel 
Php :: PHP Filters Advanced 
Php :: Bd phone number validation in laravel 
Php :: cookie phpsessid will be soon treated as cross-site cookie against 
Php :: validation.required laravel 
Php :: laravel create multiple request 
Php :: pass messages laravel 
Php :: how to use pg_dropcluster 
Php :: Reading the Blockchain PHP code 
Php :: wordpress widget categories edit 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =