Hello,
I am trying to create a new domain through the REST API in PHP but although the call successfully creates the domain, I get ERR::Connection refused after 2-3 seconds when sending the POST Request. Since the domain gets successfully created I assume that all the parameters and json format is correct. Is there any firewall or specific configuration i need to do, or is it pure php error? The website which is hosted on the same server just goes blank after few seconds
Code below:
I am trying to create a new domain through the REST API in PHP but although the call successfully creates the domain, I get ERR::Connection refused after 2-3 seconds when sending the POST Request. Since the domain gets successfully created I assume that all the parameters and json format is correct. Is there any firewall or specific configuration i need to do, or is it pure php error? The website which is hosted on the same server just goes blank after few seconds
Code below:
Code:
$url = "https://www.mydomain.com:8443/api/v2/domains/";
//set the url, number of POST vars, POST data
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);
//execute post
$result = curl_exec ($ch);
$statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close ($ch);