2015-10-03 22 views
0

我正在尝试对Gandi API进行API调用。我可以成功地调用domain.list()并接收正确的输出。但是我不能说如何根据API文档中的指示附加.zone以获取区域数据。 .i.e。 domain.zone.info()使用Gandi API调用区域信息的不良参数

API调用文档:

http://doc.rpc.gandi.net/domain/reference.html#domain.zone.info 

代码:

require_once 'gandikey.php'; 

$domain = $_POST['domain']; 
$domain_api = XML_RPC2_Client::create(
     'https://rpc.gandi.net/xmlrpc/', 
     array('prefix' => 'domain.') 
); 
$op = $domain_api->__call('zone.info', array($apikey, '14382539')); 
echo '<pre>'; 
var_dump($op); 
echo '</pre>'; 

输出:

Fatal error: Uncaught exception 'XML_RPC2_FaultException' with message 'Error on object : OBJECT_UNKNOWN (CAUSE_BADPARAMETER) [invalid method parameter(s)]' in /usr/local/share/pear/XML/RPC2/Exception.php:283 Stack trace: #0 /usr/local/share/pear/XML/RPC2/Backend/Php/Response.php(129): XML_RPC2_FaultException::createFromDecode(Object(SimpleXMLElement)) #1 /usr/local/share/pear/XML/RPC2/Backend/Php/Client.php(122): XML_RPC2_Backend_Php_Response::decode(Object(SimpleXMLElement)) #2 /usr/home/nyctelecomm/www/mkdomain/gandi-mkzone.php(56): XML_RPC2_Backend_Php_Client->__call('zone.info', Array) #3 {main} thrown in /usr/local/share/pear/XML/RPC2/Exception.php on line 283 

如何从一开始的域区信息甘地API?

回答

0

您需要通过一个整数作为第二个参数。在测试环境中https://rpc.ote.gandi.net/xmlrpc/

$domain_api->call("zone.info", [$apikey, "115553"]);` 

失败,并CAUSE_BADPARAMETER例外,而

$domain_api->call("zone.info", [$apikey, 115553]); 

回报:

array (size=8) 
    'name' => string 'Default Gandi zone file' (length=23) 
    'versions' => 
    array (size=1) 
     0 => int 1 
    'date_updated' => 
    object(stdClass)[405] 
     public 'scalar' => string '20110705T14:12:19' (length=17) 
     public 'xmlrpc_type' => string 'datetime' (length=8) 
     public 'timestamp' => int 1309875139 
    'id' => int 115553 
    'owner' => string 'BACKEND1-GANDI' (length=14) 
    'version' => int 1 
    'domains' => int 1670 
    'public' => boolean true 
相关问题