$url = "https://server.net:8443/api/v2/domains/";
$fields = array(
"name" => "example5.com",
"description"=> "My website",
"hosting_type"=> "virtual",
"hosting_settings"=> array(
"ftp_login"=> "test_login5",
"ftp_password"=> "changeme1Q**"
),
"owner_client"=> array(
"id"=> 2,
"login"=> "owner25",
"guid"=> "b623e93d-dc72-4102-b5f0-ded427cf0fb1",
"external_id"=> "b623e93d-dc72-4102-b5f0-ded427cf0fb1"
),
"ipv4"=> array(
"123.123.123.123"
),
"ipv6"=> array(
"aaaa:bbbb:cccc:dddd:eeee"
),
"plan"=> array(
"name"=> "Unlimited"
)
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_PROTOCOLS, CURLPROTO_HTTPS);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type:application/json","cache-control: no-cache","Accept: application/json"));
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "admin:password");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec ($ch);
$statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close ($ch);