我正在尝试使用我的测试 API 密钥创建一个新的测试域,但我收到一个“无效密钥”错误。我可以执行版本检查代码,但不能执行域代码?
<?php
// Library installed from PEAR
require_once 'XML/RPC2/Client.php';
$apikey = 'xxxxxxx';
$domain = "mydomain.net";
$domain_api = XML_RPC2_Client::create(
'https://rpc.gandi.net/xmlrpc/',
array( 'prefix' => 'domain.' )
);
$result = $domain_api->available($apikey, array($domain));
print_r($result);
/*
Array
(
[mydomain.net] => pending
)
*/
while ( $result[$domain] == 'pending') {
usleep(700000);
$result = $domain_api->available($apikey, array($domain));
}
//print_r($result);
/*
Array
(
[mydomain.net] => unavailable
)
*/
// dump the result
print_r( $result );
?>
error:
Fatal error: Uncaught exception 'XML_RPC2_FaultException' with message 'Error on object : OBJECT_ACCOUNT (CAUSE_NORIGHT) [Invalid API key]' in /home2/path/php/XML/RPC2/Backend/Xmlrpcext/Client.php:131 Stack trace: #0 /home2/path/public_html/buydomain/index.php(66): XML_RPC2_Backend_Xmlrpcext_Client->__call('can_associate_d...', Array) #1 /home2/path/public_html/buydomain/index.php(66): XML_RPC2_Backend_Xmlrpcext_Client->can_associate_domain('My_KEY...', 'FLN123-GANDI', Array) #2 {main} thrown in /home2/path/php/XML/RPC2/Backend/Xmlrpcext/Client.php on line 131