有人可以帮助体验域名api和php的经验

时间:2015-03-13 21:55:39

标签: php api

有没有人有过domainbox.com api的经验?我之前从未做过这样的事情,任何帮助都会非常感激。我想要做的是使用php发送请求并将结果显示在页面上,但说实话,我甚至不知道从哪里开始,或者这是否是最好的方法它

HTML

<form action="searchdomain.php" method="post">
domain: <input type="text" name="domainname">
<input type="submit">
</form>

PHP

<?php

$client = new SoapClient('https://live.domainbox.net/?WSDL', array('soap_version' => SOAP_1_2));


// populate the inputs....
    $params = array(
       'AuthenticationParameters' => array(
          'Reseller' => 'pulseinternet',
          'Username' => 'roy_admin',
          'Password' => '*********'
        ),
        'CommandParameters' => array(
            'DomainName' => '($_POST["domainname"])',
            'LaunchPhase' => 'GA'
        )
    );

$result = $client->CheckDomainAvailability($params, AvailabilityStatus);

print_r($result);
?>

结果

stdClass Object ( [CheckDomainAvailabilityResult] => stdClass Object ( [ResultCode] => 250 [ResultMsg] => TLD '' not supported [TxID] => d015865c-b99e-400f-94b9-badf89b0216f [AvailabilityStatus] => 3 [AvailabilityStatusDescr] => ErrorOccurred [LaunchPhase] => GA [DropDate] => [BackOrderAvailable] => [AdditionalResults] => stdClass Object ( ) ) )

先谢谢Roy

1 个答案:

答案 0 :(得分:0)

这是一个有效的例子:

$dom = 'test12309go.com';
$tld = '.com,.net,.org';
//$client = new SoapClient('https://sandbox.domainbox.net/?WSDL', array('trace' => true, 'soap_version' => SOAP_1_2));
$client = new SoapClient('https://live.domainbox.net/?WSDL', array('trace' => true, 'soap_version' => SOAP_1_2));
$params = array(
    'AuthenticationParameters' => array(
        'Reseller' => 'MyReseller',
        'Username' => 'MyUsername',
        'Password' => 'MyPassword'
    ),
    'CommandParameters' => array(
        'DomainName' => $dom,
    'TLDs' => $tld,
    'Limit' => '10',
    'CheckAtRegistry' => true,
      'DomainCheck' => array(
        'Include' => true
      ),
      'NameSuggestions' => array(
        'Include' => false
      ),
      'PremiumDomains' => array(
        'Include' => false
      ),
  )
);
$result = $client->CheckDomainAvailabilityPlus($params);
//echo $client->__getLastRequest();
print_r($result);