M
mike_vip
Guest
I'm sure, that my code is right. I really don't know what's wrong with it!
I've tried it with acc of domain owner (videotube) and acc of videotube's client -> webbox.eu.. but no success (my domain is webbox.eu)
My code:
test.php
I'm always getting this:
I'm going crazy...
thanks in advance
My code:
test.php
PHP:
<?php
* Reports error during API RPC request
class ApiRequestException extends Exception {}
* Returns DOM object representing request for information about all available domains
function mailInfoRequest()
{
$xmldoc = new DomDocument('1.0', 'UTF-8');
$xmldoc->formatOutput = true;
$xmldoc->loadXML('<packet version="1.4.1.2">
<domain>
<get>
<filter/>
<dataset>
<limits/>
<prefs/>
<user/>
<hosting/>
<stat/>
<gen_info/>
</dataset>
</get>
</domain>
</packet>');
return $xmldoc;
}
/**
* Prepares CURL to perform Plesk API request
* @return resource
*/
//
// int main()
//
$host = 'videotube.vshosting.cz';
$login = 'login_to_plesk';
$password = 'pass_to_plesk';
$curl = curlInit($host, $login, $password);
try {
$response = sendRequest($curl, mailInfoRequest()->saveXML());
$responseXml = parseResponse($response);
checkResponse($responseXml);
} catch (ApiRequestException $e) {
echo $e;
die();
}
// Explore the result
foreach ($responseXml->xpath('/packet/domain/get/result') as $resultNode) {
echo "Domain id: " . (string)$resultNode->id . " ";
echo (string)$resultNode->data->gen_info->name . " (" . (string)$resultNode->data->gen_info->dns_ip_address . ")\n";
}
?>
I'm always getting this:
Code:
object(SimpleXMLElement)#1 (2) { ["@attributes"]=> array(1) { ["version"]=> string(7) "1.4.1.2" } ["system"]=> object(SimpleXMLElement)#2 (3) { ["status"]=> string(5) "error" ["errcode"]=> string(4) "1006" ["errtext"]=> string(18) "Permission denied." } }
I'm going crazy...
thanks in advance