This documentation has moved

XML API documentation can now be found at developer.openprovider.com. This page will remain available until September 2026, but will no longer be updated.

The XML API itself is not changing. Your existing integration continues to work.

Bulk checkDomainRequest

From Openprovider API documentation

(Difference between revisions)
Jump to: navigation, search
WikiSysop (Talk | contribs)
(Created page with 'Before using this script, please make sure to read API General Examples <?php require_once('API.php'); $api = new OP_API('https://api.openprovider.eu…')
Newer edit →

Revision as of 12:36, 27 October 2016

Before using this script, please make sure to read API General Examples

<?php
require_once('API.php');
$api = new OP_API('https://api.openprovider.eu');

$username = '--';
$password = '--';

$domain   = 'yourdomain'; // domain name without extension
$limit    = 10; // stop processing this script after this number of checks

if (!$_SERVER['argv'][1] || stristr($_SERVER['argv'][1], '.')) {
  die("Provide a domain name (without extension) and an optional limit. Syntax:\n    check-bulk.php somedomain [limit]\n\n");
}

$request = new OP_Request;
$request->setCommand('searchExtensionRequest')
  ->setAuth(array('username' => $username, 'password' => $password))
  ->setArgs(array(
    'limit' => 3000,
    'status' => 'ACT',
    'onlyNames' => true,
  ));
$reply = $api->process($request);
$res = $reply->getValue();

foreach ($res['results'] as $ext) {
  $request = new OP_Request;
  $request->setCommand('checkDomainRequest')
    ->setAuth(array('username' => $username, 'password' => $password))
    ->setArgs(array(
      'domains' => array(
        array(
          'name' => $domain,
          'extension' => $ext,
        ),
      )
    ));
  $reply = $api->process($request);
  if ($reply->getFaultCode() == 0) {
    $res = $reply->getValue();
    echo $domain.'.'.$ext."\t".$res[0]['status']."\n";
  }
  else {
    echo $domain.'.'.$ext."\t".$reply->getFaultCode().': '.$reply->getFaultString()."\n";
  }
  if ($limit && ++$cnt >= $limit) break;
}

?>
Views
Personal tools