-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Christian Pleintinger <[email protected]>
- Loading branch information
Showing
24 changed files
with
3,094 additions
and
113 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
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,85 @@ | ||
<?php | ||
|
||
namespace Example; | ||
|
||
use Domainrobot\Domainrobot; | ||
use Domainrobot\Lib\DomainrobotAuth; | ||
use Domainrobot\Lib\DomainrobotException; | ||
use Domainrobot\Model\Domain; | ||
use Domainrobot\Model\DomainExtensions; | ||
use Domainrobot\Model\DomainBuyExtensions; | ||
use Domainrobot\Model\NameServer; | ||
use Domainrobot\Model\ObjectJob; | ||
|
||
class SDKController | ||
{ | ||
/** | ||
* Buy a domain of the Sedo premium market. | ||
* | ||
* IMPORTANT: As of now this task does not work in an sandbox enviroment, | ||
* because of the necessity to query the price of an domain | ||
* from Sedo (which only works live). | ||
* | ||
* @return ObjectJob | ||
*/ | ||
public function domainCreatePremium() | ||
{ | ||
// Create an domainrobot instance | ||
$domainrobot = new Domainrobot([ | ||
"url" => "https://api.autodns.com/v1", | ||
"auth" => new DomainrobotAuth([ | ||
"user" => "username", | ||
"password" => "password", | ||
"context" => 4 | ||
]) | ||
]); | ||
|
||
try { | ||
|
||
// Domainrobot\Model\Domain | ||
$domain = new Domain(); | ||
|
||
// Set the name of domain wanted to buy | ||
$domain->setName("sedo-example.com"); | ||
|
||
// Set the price and currency of the domain wanted to buy | ||
$domain->setExtensions(new DomainExtensions([ | ||
'domainBuyExtensions' => new DomainBuyExtensions([ | ||
'amount' => 76, | ||
'currency' => "EUR" | ||
]), | ||
])); | ||
|
||
// Set the name servers of the domain | ||
$domain->setNameServers([ | ||
new NameServer([ | ||
"name" => "ns1.example.com" | ||
]), | ||
new NameServer([ | ||
"name" => "ns2.example.com" | ||
]), | ||
new NameServer([ | ||
"name" => "ns3.example.com" | ||
]) | ||
]); | ||
|
||
// Load an existing domain contact | ||
// Domainrobot\Model\Contact | ||
$contact = $domainrobot->contact->info(23372787); | ||
|
||
// Set the necessary contact info with the loaded contact | ||
$domain->setAdminc($contact); | ||
$domain->setOwnerc($contact); | ||
$domain->setTechc($contact); | ||
$domain->setZonec($contact); | ||
|
||
// Domainrobot\Model\ObjectJob | ||
$objectJob = $domainrobot->domain->buy($domain); | ||
|
||
} catch (DomainrobotException $exception) { | ||
return $exception; | ||
} | ||
|
||
return $objectJob; | ||
} | ||
} |
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,99 @@ | ||
<?php | ||
|
||
namespace Example; | ||
|
||
use Domainrobot\Domainrobot; | ||
use Domainrobot\Lib\DomainrobotAuth; | ||
use Domainrobot\Lib\DomainrobotException; | ||
use Domainrobot\Model\Domain; | ||
use Domainrobot\Model\NameServer; | ||
use Domainrobot\Model\ObjectJob; | ||
|
||
class SDKController | ||
{ | ||
/** | ||
* Create a premium domain | ||
* | ||
* For this task there are two prerequisites. | ||
* | ||
* First and most important is that the user is allowed to order premium domains (Reseller). | ||
* | ||
* Secondly you must know a premium domain with its price class. | ||
* You can achieve that for example by searching with the domainstudio task. | ||
* | ||
* | ||
* POST /domainstudio | ||
* { | ||
* "searchToken": "example.com", | ||
* "currency": "EUR" | ||
* } | ||
* | ||
* | ||
* In the /domainstudio Response look after the attribute "source": "PREMIUM". | ||
* | ||
* With an premium domain you selected you must now inquire its price class. | ||
* | ||
* | ||
* GET /domainpremium/examples.shop | ||
* | ||
* | ||
* In the /domainpremium Response look after the attribute "priceClass". | ||
* | ||
* @return ObjectJob | ||
*/ | ||
public function domainCreatePremium() | ||
{ | ||
// Create an domainrobot instance | ||
$domainrobot = new Domainrobot([ | ||
"url" => "https://api.autodns.com/v1", | ||
"auth" => new DomainrobotAuth([ | ||
"user" => "username", | ||
"password" => "password", | ||
"context" => 4 | ||
]) | ||
]); | ||
|
||
try { | ||
|
||
// Domainrobot\Model\Domain | ||
$domain = new Domain(); | ||
|
||
// Set the name of the premium domain | ||
$domain->setName("examples.shop"); | ||
|
||
// Set the inquired price class of the premium domain | ||
$domain->setPriceClass("SHOP-TIER9"); | ||
|
||
// Set the name servers of the premium domain | ||
$domain->setNameServers([ | ||
new NameServer([ | ||
"name" => "ns1.example.shop" | ||
]), | ||
new NameServer([ | ||
"name" => "ns2.example.shop" | ||
]), | ||
new NameServer([ | ||
"name" => "ns3.example.shop" | ||
]) | ||
]); | ||
|
||
// Load an existing domain contact | ||
// Domainrobot\Model\Contact | ||
$contact = $domainrobot->contact->info(23372784); | ||
|
||
// Set the necessary contact info with the loaded contact | ||
$domain->setAdminc($contact); | ||
$domain->setOwnerc($contact); | ||
$domain->setTechc($contact); | ||
$domain->setZonec($contact); | ||
|
||
// Domainrobot\Model\ObjectJob | ||
$objectJob = $domainrobot->domain->create($domain); | ||
|
||
} catch (DomainrobotException $exception) { | ||
return $exception; | ||
} | ||
|
||
return $objectJob; | ||
} | ||
} |
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,60 @@ | ||
<?php | ||
|
||
namespace Example; | ||
|
||
use Domainrobot\Domainrobot; | ||
use Domainrobot\Lib\DomainrobotAuth; | ||
use Domainrobot\Lib\DomainrobotException; | ||
use Domainrobot\Model\Domain; | ||
use Domainrobot\Model\NameServer; | ||
use Domainrobot\Model\ObjectJob; | ||
|
||
class SDKController | ||
{ | ||
/** | ||
* Change the OwnerC of an existing domain. | ||
* | ||
* With the /domain/{name}/_ownerChange task it is possible to switch from | ||
* one domain contact to another domain contact of the same user. | ||
* | ||
* @return ObjectJob | ||
*/ | ||
public function domainOwnerChange() | ||
{ | ||
// Create an domainrobot instance | ||
$domainrobot = new Domainrobot([ | ||
"url" => "https://api.autodns.com/v1", | ||
"auth" => new DomainrobotAuth([ | ||
"user" => "username", | ||
"password" => "password", | ||
"context" => 4 | ||
]) | ||
]); | ||
|
||
try { | ||
|
||
// Domainrobot\Model\Domain | ||
$domain = new Domain(); | ||
|
||
// Set the name of the domain | ||
$domain->setName("example.com"); | ||
|
||
// Confirm the consent of the owner | ||
$domain->setConfirmOwnerConsent(true); | ||
|
||
// Domainrobot\Model\Contact | ||
$contact = $domainrobot->contact->info(23372784); | ||
|
||
// Set the new OwnerC | ||
$domain->setOwnerc($contact); | ||
|
||
// Domainrobot\Model\ObjectJob | ||
$objectJob = $domainrobot->domain->ownerChange($domain); | ||
|
||
} catch (DomainrobotException $exception) { | ||
return $exception; | ||
} | ||
|
||
return $objectJob; | ||
} | ||
} |
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,75 @@ | ||
<?php | ||
|
||
namespace Example; | ||
|
||
use Domainrobot\Domainrobot; | ||
use Domainrobot\Lib\DomainrobotAuth; | ||
use Domainrobot\Lib\DomainrobotException; | ||
use Domainrobot\Model\Domain; | ||
use Domainrobot\Model\ObjectJob; | ||
|
||
class SDKController | ||
{ | ||
/** | ||
* Change the OwnerC of an existing domain. | ||
* | ||
* With the /domain/_trade task it is possible to switch from the domain | ||
* contact of one user to the domain contact of another user (Transfer). | ||
* | ||
* For this task there are two prerequisites. | ||
* | ||
* First and most important is that the registry must support the trade task. | ||
* | ||
* Secondly you must have an valid authinfo code. | ||
* The authinfo must be generated with the /domain/{name}/_authinfo1 task. | ||
* | ||
* | ||
* GET /domain/example.be/_authinfo1 | ||
* | ||
* | ||
* In the /domain/{name}/_authinfo1 Response look after the attribute "authinfo". | ||
* | ||
* @return ObjectJob | ||
*/ | ||
public function domainTrade() | ||
{ | ||
// Create an domainrobot instance | ||
$domainrobot = new Domainrobot([ | ||
"url" => "https://api.autodns.com/v1", | ||
"auth" => new DomainrobotAuth([ | ||
"user" => "username", | ||
"password" => "password", | ||
"context" => 4 | ||
]) | ||
]); | ||
|
||
try { | ||
|
||
// Domainrobot\Model\Domain | ||
$domain = new Domain(); | ||
|
||
// Set the name of the domain which should be transfered to the new OwnerC | ||
$domain->setName("example.be"); | ||
|
||
// Set the authinfo code | ||
$domain->setAuthinfo("-qm-WJbL3DqyABCb"); | ||
|
||
// Confirm the consent of the owner | ||
$domain->setConfirmOwnerConsent(true); | ||
|
||
// Domainrobot\Model\Contact | ||
$contact = $domainrobot->contact->info(23372784); | ||
|
||
// Set the new OwnerC | ||
$domain->setOwnerc($contact); | ||
|
||
// Domainrobot\Model\ObjectJob | ||
$objectJob = $domainrobot->domain->trade($domain); | ||
|
||
} catch (DomainrobotException $exception) { | ||
return $exception; | ||
} | ||
|
||
return $objectJob; | ||
} | ||
} |
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,55 @@ | ||
<?php | ||
|
||
namespace Example; | ||
|
||
use Domainrobot\Domainrobot; | ||
use Domainrobot\Lib\DomainrobotAuth; | ||
use Domainrobot\Lib\DomainrobotException; | ||
use Domainrobot\Model\Redirect; | ||
|
||
class SDKController | ||
{ | ||
/** | ||
* Create an domain redirect | ||
* | ||
* @return Redirect | ||
*/ | ||
public function redirectCreateDomain() | ||
{ | ||
// Create an domainrobot instance | ||
$domainrobot = new Domainrobot([ | ||
"url" => "https://api.autodns.com/v1", | ||
"auth" => new DomainrobotAuth([ | ||
"user" => "username", | ||
"password" => "password", | ||
"context" => 4 | ||
]) | ||
]); | ||
|
||
try { | ||
|
||
// Domainrobot\Model\Redirect | ||
$redirect = new Redirect(); | ||
|
||
// Set the source domain | ||
$redirect->setSource("example-1.com"); | ||
|
||
// Set the target path | ||
$redirect->setTarget("example-2.com/test"); | ||
|
||
// Set type DOMAIN | ||
$redirect->setType("DOMAIN"); | ||
|
||
// Set mode HTTP | ||
$redirect->setMode("HTTP"); | ||
|
||
// Domainrobot\Model\Redirect | ||
$object = $domainrobot->redirect->create($redirect); | ||
|
||
} catch (DomainrobotException $exception) { | ||
return $exception; | ||
} | ||
|
||
return $object; | ||
} | ||
} |
Oops, something went wrong.