<?php
function get($host, $login, $password, $packet){
$curl = curl_init();
curl_setopt($curl,CURLOPT_URL, "https://{$host}:8443/enterprise/control/agent.php");
curl_setopt($curl,CURLOPT_RETURNTRANSFER,true);
curl_setopt($curl,CURLOPT_POST,true);
curl_setopt($curl,CURLOPT_SSL_VERIFYPEER,false);
curl_setopt($curl,CURLOPT_SSL_VERIFYHOST,false);
curl_setopt($curl,CURLOPT_HTTPHEADER,array("HTTP_AUTH_LOGIN: {$login}","HTTP_AUTH_PASSWD: {$password}","HTTP_PRETTY_PRINT: TRUE","Content-Type: text/xml"));
curl_setopt($curl,CURLOPT_POSTFIELDS,$packet);
$result = curl_exec($curl);
$xml = new SimpleXMLElement($result);
if (curl_errno($curl)){
$errmsg = curl_error($curl);
$errcode = curl_errno($curl);
curl_close($curl);
throw new ApiRequestException($errmsg, $errcode);
}
curl_close($curl);
return $xml;
}
function domain_get($host, $login, $password,$domain){
$packet = '<packet version="1.6.0.0"><domain><get><filter><domain-name>'.$domain.'</domain-name></filter><dataset><hosting/><limits/><stat/></dataset></get></domain></packet>';
return $this->get($host, $login, $password,$packet);
}
print_r(domain_get('12.12.12.12','admin','123456','test.com'));
?>