你可能會使用WHMCS API,例如訂購產品或域,您將使用AddOrder API函數如下圖所示:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
http_build_query(
array(
'action' => 'AddOrder',
// See https://developers.whmcs.com/api/authentication
'username' => 'IDENTIFIER_OR_ADMIN_USERNAME',
'password' => 'SECRET_OR_HASHED_PASSWORD',
'clientid' => '1',
'pid' => array(1,1),
'domain' => array('domain1.com', 'domain2.com'),
'billingcycle' => array('monthly','semi-annually'),
'domaintype' => array('register', 'register'),
'regperiod' => array(1, 2),
'dnsmanagement' => array(0 => false, 1 => true),
'nameserver1' => 'ns1.demo.com',
'nameserver2' => 'ns2.demo.com',
'paymentmethod' => 'mailin',
'responsetype' => 'json',
)
)
);
$response = curl_exec($ch);
curl_close($ch);