-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added example-script for successively download of the domain-list
- Loading branch information
Bailey Rud
committed
Sep 19, 2016
1 parent
f19a975
commit 4f06d71
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
|
||
?> |