<?php
if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    $response_data = json_decode($response, true);
    if ($response_data['success']) {
        echo "Subdomain $subdomain.$main_domain created successfully.";
    } else {
        echo "Failed to create subdomain: " . $response_data['errors'][0]['message'];
    }
}