Bulk checkDomainRequest
From Openprovider API documentation
(Difference between revisions)
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 →
(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;
}
?>