Skip to content

Commit

Permalink
Added example-script for successively download of the domain-list
Browse files Browse the repository at this point in the history
  • Loading branch information
Bailey Rud committed Sep 19, 2016
1 parent f19a975 commit 4f06d71
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions domainlist_successively.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php
/*
* XML-RPC support in PHP is not enabled by default.
* You will need to use the --with-xmlrpc[=DIR] configuration option when compiling PHP to enable XML-RPC support.
* This extension is bundled into PHP as of 4.1.0.
*
* cURL needs to be installed and activated
*
*/

header('Content-type: text/plain; charset=utf-8');
error_reporting(E_ALL);
require "INWX/Domrobot.php";


$addr = "https://api.domrobot.com/xmlrpc/";
//$addr = "https://api.ote.domrobot.com/xmlrpc/";

$usr = "";
$pwd = "";

$domains_per_request = 20;
$sleep_between_requests = 1;


$domrobot = new INWX\Domrobot($addr);
$domrobot->setDebug(false);
$domrobot->setLanguage('en');
$res = $res_lgn = $domrobot->login($usr,$pwd);

$domains = array();

if($res_lgn['code'] == 1000){
$res_count = $domrobot->call("domain", "list", array("page" => 1, "pagelimit" => 1));
$num_domains = (int) $res_count['resData']['count'];
$pages = round(($num_domains / $domains_per_request)+2, 0);
for($i=1;$i<$pages;$i++){
$res = $domrobot->call("domain", "list", array("page" => $i, "pagelimit" => $domains_per_request));
foreach($res['resData']['domain'] as $domain){
$domains[] = $domain;
}
if($sleep_between_requests !== false && is_numeric($sleep_between_requests)) sleep((int) $sleep_between_requests);
}
print_r($domains);
} else{
print_r($res_lgn);
}

?>

0 comments on commit 4f06d71

Please sign in to comment.